Fix profiles and saving grids to accounts

This commit is contained in:
Justin Edmund 2020-10-19 06:09:05 -07:00
parent 931925a72e
commit 70461a0e6d
4 changed files with 10 additions and 7 deletions

View file

@ -29,6 +29,7 @@
.GridRep .grid_weapons {
list-style: none;
margin: 0;
padding: 0;
}

View file

@ -2,8 +2,8 @@ import React, { useEffect, useState } from 'react'
import './index.css'
import mainhandImages from '../../images/mainhand/*.jpg'
import gridImages from '../../images/grid/*.jpg'
import mainhandImages from '../../images/weapon-main/*.jpg'
import gridImages from '../../images/weapon-grid/*.jpg'
interface Props {
shortcode: string
@ -43,7 +43,7 @@ const GridRep = (props: Props) => {
? <img src={
process.env.NODE_ENV === 'development'
? mainhandImages[mainhand?.granblue_id || 0]
: `${process.env.SIERO_IMG_URL}/mainhand/${mainhand?.granblue_id}.jpg`
: `${process.env.SIERO_IMG_URL}/weapon-main/${mainhand?.granblue_id}.jpg`
} />
: <img />
}
@ -53,7 +53,7 @@ const GridRep = (props: Props) => {
? <img src={
process.env.NODE_ENV === 'development'
? gridImages[weapons[position]?.granblue_id || 0]
: `${process.env.SIERO_IMG_URL}/grid/${weapons[position]?.granblue_id}.jpg`
: `${process.env.SIERO_IMG_URL}/weapon-grid/${weapons[position]?.granblue_id}.jpg`
} />
: <img />
}

View file

@ -35,12 +35,14 @@ interface Props {
const Party = (props: Props) => {
const [cookies, setCookie] = useCookies(['user'])
const headers = (cookies.user) ? {
const headers = (cookies.user != null) ? {
headers: {
'Authorization': `Bearer ${cookies.user.access_token}`
}
} : {}
console.log(headers)
// Grid data
const [characters, setCharacters] = useState<GridArray<Character>>({})
const [weapons, setWeapons] = useState<GridArray<Weapon>>({})

View file

@ -20,7 +20,7 @@ interface User {
interface Party {
id: string
shortcode: string
grid: GridWeapon[]
weapons: GridWeapon[]
}
interface ProfileProps extends RouteComponentProps<Props> {}
@ -90,7 +90,7 @@ const ProfileRoute: React.FC<ProfileProps> = ({ history, match }) => {
parties.map((party, i) => {
return <GridRep
shortcode={party.shortcode}
grid={party.grid}
grid={party.weapons}
key={`party-${i}`}
onClick={navigate}
/>