From 69aa0ec528beaef5639af9eeecd5e9c117ec8560 Mon Sep 17 00:00:00 2001 From: Justin Edmund Date: Mon, 28 Feb 2022 01:02:28 -0800 Subject: [PATCH] Update state when saving/unsaving --- components/TopHeader/index.tsx | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/components/TopHeader/index.tsx b/components/TopHeader/index.tsx index 2893ff26..b9b5897c 100644 --- a/components/TopHeader/index.tsx +++ b/components/TopHeader/index.tsx @@ -69,6 +69,10 @@ const TopHeader = () => { function saveFavorite() { if (party.id) api.saveTeam({ id: party.id, params: headers }) + .then((response) => { + if (response.status == 201) + appState.party.favorited = true + }) else console.error("Failed to save team: No party ID") } @@ -76,6 +80,10 @@ const TopHeader = () => { function unsaveFavorite() { if (party.id) api.unsaveTeam({ id: party.id, params: headers }) + .then((response) => { + if (response.status == 200) + appState.party.favorited = false + }) else console.error("Failed to unsave team: No party ID") }