Fix various API and rendering bugs

This commit is contained in:
Justin Edmund 2022-11-16 07:04:39 -08:00
parent c05f86d012
commit 21b86e4239
5 changed files with 17 additions and 13 deletions

View file

@ -90,7 +90,7 @@ const GridRep = (props: Props) => {
function generateGridImage(position: number) {
let url = ""
if (weapons[position]) {
if (weapons[position] && props.grid[position]) {
if (weapons[position].element == 0 && props.grid[position].element) {
url = `${process.env.NEXT_PUBLIC_SIERO_IMG_URL}/weapon-grid/${weapons[position]?.granblue_id}_${props.grid[position].element}.jpg`
} else {

View file

@ -340,7 +340,7 @@ export const getServerSideProps = async ({ req, res, locale, query }: { req: Nex
: {}
let { raids, sortedRaids } = await api.endpoints.raids
.getAll(headers)
.getAll({ params: headers })
.then((response) => organizeRaids(response.data.map((r: any) => r.raid)))
// Extract recency filter
@ -377,9 +377,9 @@ export const getServerSideProps = async ({ req, res, locale, query }: { req: Nex
const response = await api.endpoints.users.getOne({
id: query.username,
params: {
params: filters,
...headers
}
...filters,
},
...headers,
})
user = response.data.user

View file

@ -48,9 +48,9 @@ export const getServerSideProps = async ({ req, res, locale, query }: { req: Nex
: {}
let { raids, sortedRaids } = await api.endpoints.raids
.getAll(headers)
.getAll({ params: headers })
.then((response) => organizeRaids(response.data.map((r: any) => r.raid)))
return {
props: {
raids: raids,

View file

@ -343,9 +343,9 @@ export const getServerSideProps = async ({ req, res, locale, query }: { req: Nex
const headers = accountData
? { headers: { Authorization: `Bearer ${accountData.token}` } }
: {}
let { raids, sortedRaids } = await api.endpoints.raids
.getAll(headers)
.getAll({ params: headers })
.then((response) => organizeRaids(response.data.map((r: any) => r.raid)))
// Extract recency filter
@ -377,7 +377,9 @@ export const getServerSideProps = async ({ req, res, locale, query }: { req: Nex
// Fetch initial set of parties here
const response = await api.savedTeams({
params: filters,
params: {
...filters,
},
...headers
})

View file

@ -353,7 +353,7 @@ export const getServerSideProps = async ({ req, res, locale, query }: { req: Nex
: {}
let { raids, sortedRaids } = await api.endpoints.raids
.getAll(headers)
.getAll({ params: headers })
.then((response) => organizeRaids(response.data.map((r: any) => r.raid)))
// Extract recency filter
@ -385,8 +385,10 @@ export const getServerSideProps = async ({ req, res, locale, query }: { req: Nex
// Fetch initial set of parties here
const response = await api.endpoints.parties.getAll({
params: filters,
...headers
params: {
...filters,
},
...headers,
})
return {