Fix saving objects and jobs
There's still bugs with jobs though
This commit is contained in:
parent
bbcdb74ade
commit
7c36aac130
3 changed files with 9 additions and 9 deletions
|
|
@ -104,7 +104,7 @@ const CharacterGrid = (props: Props) => {
|
||||||
|
|
||||||
if (props.pushHistory) props.pushHistory(`/p/${party.shortcode}`)
|
if (props.pushHistory) props.pushHistory(`/p/${party.shortcode}`)
|
||||||
saveCharacter(party.id, character, position)
|
saveCharacter(party.id, character, position)
|
||||||
.then((response) => storeGridCharacter(response.data.grid_character))
|
.then((response) => storeGridCharacter(response.data))
|
||||||
.catch((error) => console.error(error))
|
.catch((error) => console.error(error))
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -122,7 +122,7 @@ const CharacterGrid = (props: Props) => {
|
||||||
setPosition(data.position)
|
setPosition(data.position)
|
||||||
setModalOpen(true)
|
setModalOpen(true)
|
||||||
} else {
|
} else {
|
||||||
storeGridCharacter(data.grid_character)
|
storeGridCharacter(data)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -159,7 +159,7 @@ const CharacterGrid = (props: Props) => {
|
||||||
})
|
})
|
||||||
.then((response) => {
|
.then((response) => {
|
||||||
// Store new character in state
|
// Store new character in state
|
||||||
storeGridCharacter(response.data.grid_character)
|
storeGridCharacter(response.data)
|
||||||
|
|
||||||
// Remove conflicting characters from state
|
// Remove conflicting characters from state
|
||||||
conflicts.forEach(
|
conflicts.forEach(
|
||||||
|
|
@ -192,7 +192,7 @@ const CharacterGrid = (props: Props) => {
|
||||||
|
|
||||||
if (party.id && appState.party.editable) {
|
if (party.id && appState.party.editable) {
|
||||||
api.updateJob({ partyId: party.id, params: payload }).then((response) => {
|
api.updateJob({ partyId: party.id, params: payload }).then((response) => {
|
||||||
const newParty = response.data.party
|
const newParty = response.data
|
||||||
|
|
||||||
setJob(newParty.job)
|
setJob(newParty.job)
|
||||||
appState.party.job = newParty.job
|
appState.party.job = newParty.job
|
||||||
|
|
@ -269,7 +269,7 @@ const CharacterGrid = (props: Props) => {
|
||||||
try {
|
try {
|
||||||
if (uncapLevel != previousUncapValues[position])
|
if (uncapLevel != previousUncapValues[position])
|
||||||
await api.updateUncap('character', id, uncapLevel).then((response) => {
|
await api.updateUncap('character', id, uncapLevel).then((response) => {
|
||||||
storeGridCharacter(response.data.grid_character)
|
storeGridCharacter(response.data)
|
||||||
})
|
})
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error)
|
console.error(error)
|
||||||
|
|
|
||||||
|
|
@ -96,13 +96,13 @@ const SummonGrid = (props: Props) => {
|
||||||
if (props.pushHistory) props.pushHistory(`/p/${party.shortcode}`)
|
if (props.pushHistory) props.pushHistory(`/p/${party.shortcode}`)
|
||||||
|
|
||||||
saveSummon(party.id, summon, position).then((response) =>
|
saveSummon(party.id, summon, position).then((response) =>
|
||||||
storeGridSummon(response.data.grid_summon)
|
storeGridSummon(response.data)
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
if (party.editable)
|
if (party.editable)
|
||||||
saveSummon(party.id, summon, position).then((response) =>
|
saveSummon(party.id, summon, position).then((response) =>
|
||||||
storeGridSummon(response.data.grid_summon)
|
storeGridSummon(response.data)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -86,12 +86,12 @@ const WeaponGrid = (props: Props) => {
|
||||||
if (props.pushHistory) props.pushHistory(`/p/${party.shortcode}`)
|
if (props.pushHistory) props.pushHistory(`/p/${party.shortcode}`)
|
||||||
|
|
||||||
saveWeapon(party.id, weapon, position).then((response) =>
|
saveWeapon(party.id, weapon, position).then((response) =>
|
||||||
storeGridWeapon(response.data.grid_weapon)
|
storeGridWeapon(response.data)
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
saveWeapon(party.id, weapon, position).then((response) =>
|
saveWeapon(party.id, weapon, position).then((response) =>
|
||||||
storeGridWeapon(response.data.grid_weapon)
|
storeGridWeapon(response.data)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue