Remove cookies/headers
We don't make any auth'd calls here
This commit is contained in:
parent
1d0c242429
commit
657026e8b5
1 changed files with 2 additions and 8 deletions
|
|
@ -1,5 +1,4 @@
|
||||||
import React, { useCallback, useEffect, useState } from 'react'
|
import React, { useCallback, useEffect, useState } from 'react'
|
||||||
import { useCookies } from 'react-cookie'
|
|
||||||
|
|
||||||
import { appState } from '~utils/appState'
|
import { appState } from '~utils/appState'
|
||||||
import api from '~utils/api'
|
import api from '~utils/api'
|
||||||
|
|
@ -15,7 +14,6 @@ interface Props {
|
||||||
}
|
}
|
||||||
|
|
||||||
const RaidDropdown = React.forwardRef<HTMLSelectElement, Props>(function useFieldSet(props, ref) {
|
const RaidDropdown = React.forwardRef<HTMLSelectElement, Props>(function useFieldSet(props, ref) {
|
||||||
const [cookies] = useCookies(['user'])
|
|
||||||
const [raids, setRaids] = useState<Raid[][]>()
|
const [raids, setRaids] = useState<Raid[][]>()
|
||||||
|
|
||||||
const raidGroups = [
|
const raidGroups = [
|
||||||
|
|
@ -50,12 +48,8 @@ const RaidDropdown = React.forwardRef<HTMLSelectElement, Props>(function useFiel
|
||||||
}, [props.allOption])
|
}, [props.allOption])
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const headers = (cookies.user != null) ? {
|
|
||||||
headers: { 'Authorization': `Bearer ${cookies.user.access_token}` }
|
|
||||||
} : {}
|
|
||||||
|
|
||||||
function fetchRaids() {
|
function fetchRaids() {
|
||||||
api.endpoints.raids.getAll(headers)
|
api.endpoints.raids.getAll()
|
||||||
.then((response) => {
|
.then((response) => {
|
||||||
const raids = response.data.map((r: any) => r.raid)
|
const raids = response.data.map((r: any) => r.raid)
|
||||||
|
|
||||||
|
|
@ -65,7 +59,7 @@ const RaidDropdown = React.forwardRef<HTMLSelectElement, Props>(function useFiel
|
||||||
}
|
}
|
||||||
|
|
||||||
fetchRaids()
|
fetchRaids()
|
||||||
}, [cookies.user, organizeRaids])
|
}, [organizeRaids])
|
||||||
|
|
||||||
function raidGroup(index: number) {
|
function raidGroup(index: number) {
|
||||||
const options = raids && raids.length > 0 && raids[index].length > 0 &&
|
const options = raids && raids.length > 0 && raids[index].length > 0 &&
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue