Save favorited/user when fetching party data
This commit is contained in:
parent
b78994b68c
commit
99f2a65cf8
4 changed files with 9 additions and 2 deletions
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Reference in a new issue