List of raids no longer has root keys

This commit is contained in:
Justin Edmund 2022-12-22 00:09:50 -08:00
parent 46034e6aad
commit caf2bca38f
6 changed files with 12 additions and 17 deletions

View file

@ -78,9 +78,7 @@ const RaidDropdown = React.forwardRef<HTMLSelectElement, Props>(
useEffect(() => { useEffect(() => {
api.endpoints.raids api.endpoints.raids
.getAll() .getAll()
.then((response) => .then((response) => organizeRaids(response.data))
organizeRaids(response.data.map((r: any) => r.raid))
)
}, [organizeRaids]) }, [organizeRaids])
// Set current raid on mount // Set current raid on mount

View file

@ -166,12 +166,11 @@ const ProfileRoute: React.FC<Props> = (props: Props) => {
// Fetch all raids on mount, then find the raid in the URL if present // Fetch all raids on mount, then find the raid in the URL if present
useEffect(() => { useEffect(() => {
api.endpoints.raids.getAll().then((response) => { api.endpoints.raids.getAll().then((response) => {
const cleanRaids: Raid[] = response.data.map((r: any) => r.raid) setRaids(response.data)
setRaids(cleanRaids)
setRaidsLoading(false) setRaidsLoading(false)
const raid = cleanRaids.find((r) => r.slug === raidSlug) const raid = response.data.find((r: Raid) => r.slug === raidSlug)
setRaid(raid) setRaid(raid)
return raid return raid
@ -343,7 +342,7 @@ export const getServerSideProps = async ({ req, res, locale, query }: { req: Nex
let { raids, sortedRaids } = await api.endpoints.raids let { raids, sortedRaids } = await api.endpoints.raids
.getAll({ params: headers }) .getAll({ params: headers })
.then((response) => organizeRaids(response.data.map((r: any) => r.raid))) .then((response) => organizeRaids(response.data))
// Extract recency filter // Extract recency filter
const recencyParam: number = parseInt(query.recency) const recencyParam: number = parseInt(query.recency)

View file

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

View file

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

View file

@ -157,12 +157,11 @@ const SavedRoute: React.FC<Props> = (props: Props) => {
// Fetch all raids on mount, then find the raid in the URL if present // Fetch all raids on mount, then find the raid in the URL if present
useEffect(() => { useEffect(() => {
api.endpoints.raids.getAll().then((response) => { api.endpoints.raids.getAll().then((response) => {
const cleanRaids: Raid[] = response.data.map((r: any) => r.raid) setRaids(response.data)
setRaids(cleanRaids)
setRaidsLoading(false) setRaidsLoading(false)
const raid = cleanRaids.find((r) => r.slug === raidSlug) const raid = response.data.find((r: Raid) => r.slug === raidSlug)
setRaid(raid) setRaid(raid)
return raid return raid
@ -348,7 +347,7 @@ export const getServerSideProps = async ({ req, res, locale, query }: { req: Nex
let { raids, sortedRaids } = await api.endpoints.raids let { raids, sortedRaids } = await api.endpoints.raids
.getAll({ params: headers }) .getAll({ params: headers })
.then((response) => organizeRaids(response.data.map((r: any) => r.raid))) .then((response) => organizeRaids(response.data))
// Extract recency filter // Extract recency filter
const recencyParam: number = parseInt(query.recency) const recencyParam: number = parseInt(query.recency)

View file

@ -157,12 +157,11 @@ const TeamsRoute: React.FC<Props> = (props: Props) => {
// Fetch all raids on mount, then find the raid in the URL if present // Fetch all raids on mount, then find the raid in the URL if present
useEffect(() => { useEffect(() => {
api.endpoints.raids.getAll().then((response) => { api.endpoints.raids.getAll().then((response) => {
const cleanRaids: Raid[] = response.data.map((r: any) => r.raid) setRaids(response.data)
setRaids(cleanRaids)
setRaidsLoading(false) setRaidsLoading(false)
const raid = cleanRaids.find((r) => r.slug === raidSlug) const raid = response.data.find((r: Raid) => r.slug === raidSlug)
setRaid(raid) setRaid(raid)
return raid return raid
@ -356,7 +355,7 @@ export const getServerSideProps = async ({ req, res, locale, query }: { req: Nex
let { raids, sortedRaids } = await api.endpoints.raids let { raids, sortedRaids } = await api.endpoints.raids
.getAll({ params: headers }) .getAll({ params: headers })
.then((response) => organizeRaids(response.data.map((r: any) => r.raid))) .then((response) => organizeRaids(response.data))
// Extract recency filter // Extract recency filter
const recencyParam: number = parseInt(query.recency) const recencyParam: number = parseInt(query.recency)