Fix weapon modal
Updates weapon keys with cookies
This commit is contained in:
parent
61a762b29b
commit
67aa814b27
1 changed files with 8 additions and 10 deletions
|
|
@ -1,5 +1,5 @@
|
||||||
import React, { useState } from "react"
|
import React, { useState } from "react"
|
||||||
// import { useCookies } from 'react-cookie'
|
import { getCookie } from "cookies-next"
|
||||||
import { useRouter } from "next/router"
|
import { useRouter } from "next/router"
|
||||||
import { useTranslation } from "next-i18next"
|
import { useTranslation } from "next-i18next"
|
||||||
import { AxiosResponse } from "axios"
|
import { AxiosResponse } from "axios"
|
||||||
|
|
@ -42,15 +42,13 @@ const WeaponModal = (props: Props) => {
|
||||||
const { t } = useTranslation("common")
|
const { t } = useTranslation("common")
|
||||||
|
|
||||||
// Cookies
|
// Cookies
|
||||||
const [cookies] = useCookies(["account"])
|
const cookie = getCookie("account")
|
||||||
const headers =
|
const accountData: AccountCookie = cookie
|
||||||
cookies.account != null
|
? JSON.parse(cookie as string)
|
||||||
? {
|
: null
|
||||||
headers: {
|
const headers = accountData
|
||||||
Authorization: `Bearer ${cookies.account.access_token}`,
|
? { Authorization: `Bearer ${accountData.token}` }
|
||||||
},
|
: {}
|
||||||
}
|
|
||||||
: {}
|
|
||||||
|
|
||||||
// Refs
|
// Refs
|
||||||
const weaponKey1Select = React.createRef<HTMLSelectElement>()
|
const weaponKey1Select = React.createRef<HTMLSelectElement>()
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue