Add typing to the object grids and match new API

This commit is contained in:
Justin Edmund 2022-02-27 00:35:41 -08:00
parent 3b4b8ecc1a
commit 23ff979e83
3 changed files with 11 additions and 11 deletions

View file

@ -65,10 +65,10 @@ const CharacterGrid = (props: Props) => {
function processResult(response: AxiosResponse) {
// Store the response
const party = response.data.party
const party: Party = response.data.party
// Get the party user and logged in user, if possible, to compare
const partyUser = (party.user_id) ? party.user_id : undefined
const partyUser = (party.user) ? party.user.id : undefined
const loggedInUser = (cookies.user) ? cookies.user.user_id : ''
if (partyUser != undefined && loggedInUser != undefined && partyUser === loggedInUser)
@ -97,7 +97,7 @@ const CharacterGrid = (props: Props) => {
}
}
function populateCharacters(list: [GridCharacter]) {
function populateCharacters(list: Array<GridCharacter>) {
list.forEach((object: GridCharacter) => {
if (object.position != null)
appState.grid.characters[object.position] = object

View file

@ -75,10 +75,10 @@ const SummonGrid = (props: Props) => {
function processResult(response: AxiosResponse) {
// Store the response
const party = response.data.party
const party: Party = response.data.party
// Get the party user and logged in user, if possible, to compare
const partyUser = (party.user_id) ? party.user_id : undefined
const partyUser = (party.user) ? party.user.id : undefined
const loggedInUser = (cookies.user) ? cookies.user.user_id : ''
if (partyUser != undefined && loggedInUser != undefined && partyUser === loggedInUser)
@ -107,7 +107,7 @@ const SummonGrid = (props: Props) => {
}
}
function populateSummons(list: [GridSummon]) {
function populateSummons(list: Array<GridSummon>) {
list.forEach((gridObject: GridSummon) => {
if (gridObject.main)
appState.grid.summons.mainSummon = gridObject

View file

@ -71,10 +71,10 @@ const WeaponGrid = (props: Props) => {
function processResult(response: AxiosResponse) {
// Store the response
const party = response.data.party
const party: Party = response.data.party
// Get the party user and logged in user, if possible, to compare
const partyUser = (party.user_id) ? party.user_id : undefined
const partyUser = (party.user) ? party.user.id : undefined
const loggedInUser = (cookies.user) ? cookies.user.user_id : ''
if (partyUser != undefined && loggedInUser != undefined && partyUser === loggedInUser)
@ -84,7 +84,7 @@ const WeaponGrid = (props: Props) => {
// Store the important party and state-keeping values
appState.party.id = party.id
appState.party.extra = party.is_extra
appState.party.extra = party.extra
setFound(true)
@ -105,7 +105,7 @@ const WeaponGrid = (props: Props) => {
}
}
function populateWeapons(list: [GridWeapon]) {
function populateWeapons(list: Array<GridWeapon>) {
list.forEach((gridObject: GridWeapon) => {
if (gridObject.mainhand) {
appState.grid.weapons.mainWeapon = gridObject