Save favorited/user when fetching party data

This commit is contained in:
Justin Edmund 2022-02-27 22:31:16 -08:00
parent b78994b68c
commit 99f2a65cf8
4 changed files with 9 additions and 2 deletions

View file

@ -78,6 +78,8 @@ const CharacterGrid = (props: Props) => {
// Store the important party and state-keeping values
appState.party.id = party.id
appState.party.user = party.user
appState.party.favorited = party.favorited
setFound(true)
setLoading(false)

View file

@ -117,13 +117,15 @@ const Party = (props: Props) => {
// Methods: Fetch party details
function fetchDetails(shortcode: string) {
return api.endpoints.parties.getOne({ id: shortcode })
return api.endpoints.parties.getOne({ id: shortcode, params: headers })
.then(response => processResult(response))
.catch(error => processError(error))
}
function processResult(response: AxiosResponse) {
appState.party.id = response.data.party.id
appState.party.user = response.data.party.user
appState.party.favorited = response.data.party.favorited
// Store the party's user-generated details
appState.party.name = response.data.party.name

View file

@ -88,6 +88,8 @@ const SummonGrid = (props: Props) => {
// Store the important party and state-keeping values
appState.party.id = party.id
appState.party.user = party.user
appState.party.favorited = party.favorited
setFound(true)
setLoading(false)

View file

@ -85,7 +85,8 @@ const WeaponGrid = (props: Props) => {
// Store the important party and state-keeping values
appState.party.id = party.id
appState.party.extra = party.extra
appState.party.user = party.user
appState.party.favorited = party.favorited
setFound(true)
setLoading(false)