Update state when saving/unsaving
This commit is contained in:
parent
bf3007f85e
commit
69aa0ec528
1 changed files with 8 additions and 0 deletions
|
|
@ -69,6 +69,10 @@ const TopHeader = () => {
|
||||||
function saveFavorite() {
|
function saveFavorite() {
|
||||||
if (party.id)
|
if (party.id)
|
||||||
api.saveTeam({ id: party.id, params: headers })
|
api.saveTeam({ id: party.id, params: headers })
|
||||||
|
.then((response) => {
|
||||||
|
if (response.status == 201)
|
||||||
|
appState.party.favorited = true
|
||||||
|
})
|
||||||
else
|
else
|
||||||
console.error("Failed to save team: No party ID")
|
console.error("Failed to save team: No party ID")
|
||||||
}
|
}
|
||||||
|
|
@ -76,6 +80,10 @@ const TopHeader = () => {
|
||||||
function unsaveFavorite() {
|
function unsaveFavorite() {
|
||||||
if (party.id)
|
if (party.id)
|
||||||
api.unsaveTeam({ id: party.id, params: headers })
|
api.unsaveTeam({ id: party.id, params: headers })
|
||||||
|
.then((response) => {
|
||||||
|
if (response.status == 200)
|
||||||
|
appState.party.favorited = false
|
||||||
|
})
|
||||||
else
|
else
|
||||||
console.error("Failed to unsave team: No party ID")
|
console.error("Failed to unsave team: No party ID")
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue