From caf2bca38f9f8080afc2a6bff965c3f0bcf53ec7 Mon Sep 17 00:00:00 2001 From: Justin Edmund Date: Thu, 22 Dec 2022 00:09:50 -0800 Subject: [PATCH] List of raids no longer has root keys --- components/RaidDropdown/index.tsx | 4 +--- pages/[username].tsx | 7 +++---- pages/new/index.tsx | 2 +- pages/p/[party].tsx | 2 +- pages/saved.tsx | 7 +++---- pages/teams.tsx | 7 +++---- 6 files changed, 12 insertions(+), 17 deletions(-) diff --git a/components/RaidDropdown/index.tsx b/components/RaidDropdown/index.tsx index 636caf0c..79af2f64 100644 --- a/components/RaidDropdown/index.tsx +++ b/components/RaidDropdown/index.tsx @@ -78,9 +78,7 @@ const RaidDropdown = React.forwardRef( useEffect(() => { api.endpoints.raids .getAll() - .then((response) => - organizeRaids(response.data.map((r: any) => r.raid)) - ) + .then((response) => organizeRaids(response.data)) }, [organizeRaids]) // Set current raid on mount diff --git a/pages/[username].tsx b/pages/[username].tsx index d941828a..9714c55b 100644 --- a/pages/[username].tsx +++ b/pages/[username].tsx @@ -166,12 +166,11 @@ const ProfileRoute: React.FC = (props: Props) => { // Fetch all raids on mount, then find the raid in the URL if present useEffect(() => { api.endpoints.raids.getAll().then((response) => { - const cleanRaids: Raid[] = response.data.map((r: any) => r.raid) - setRaids(cleanRaids) + setRaids(response.data) setRaidsLoading(false) - const raid = cleanRaids.find((r) => r.slug === raidSlug) + const raid = response.data.find((r: Raid) => r.slug === raidSlug) setRaid(raid) return raid @@ -343,7 +342,7 @@ export const getServerSideProps = async ({ req, res, locale, query }: { req: Nex let { raids, sortedRaids } = await api.endpoints.raids .getAll({ params: headers }) - .then((response) => organizeRaids(response.data.map((r: any) => r.raid))) + .then((response) => organizeRaids(response.data)) // Extract recency filter const recencyParam: number = parseInt(query.recency) diff --git a/pages/new/index.tsx b/pages/new/index.tsx index ca77a77f..a516bc5b 100644 --- a/pages/new/index.tsx +++ b/pages/new/index.tsx @@ -59,7 +59,7 @@ export const getServerSideProps = async ({ req, res, locale, query }: { req: Nex let { raids, sortedRaids } = await api.endpoints.raids .getAll({ params: headers }) - .then((response) => organizeRaids(response.data.map((r: any) => r.raid))) + .then((response) => organizeRaids(response.data)) let jobs = await api.endpoints.jobs .getAll({ params: headers }) diff --git a/pages/p/[party].tsx b/pages/p/[party].tsx index bc8715c1..6059dd71 100644 --- a/pages/p/[party].tsx +++ b/pages/p/[party].tsx @@ -55,7 +55,7 @@ export const getServerSideProps = async ({ req, res, locale, query }: { req: Nex let { raids, sortedRaids } = await api.endpoints.raids .getAll() - .then((response) => organizeRaids(response.data.map((r: any) => r.raid))) + .then((response) => organizeRaids(response.data)) let jobs = await api.endpoints.jobs .getAll({ params: headers }) diff --git a/pages/saved.tsx b/pages/saved.tsx index 6ec6417c..6d163cc7 100644 --- a/pages/saved.tsx +++ b/pages/saved.tsx @@ -157,12 +157,11 @@ const SavedRoute: React.FC = (props: Props) => { // Fetch all raids on mount, then find the raid in the URL if present useEffect(() => { api.endpoints.raids.getAll().then((response) => { - const cleanRaids: Raid[] = response.data.map((r: any) => r.raid) - setRaids(cleanRaids) + setRaids(response.data) setRaidsLoading(false) - const raid = cleanRaids.find((r) => r.slug === raidSlug) + const raid = response.data.find((r: Raid) => r.slug === raidSlug) setRaid(raid) return raid @@ -348,7 +347,7 @@ export const getServerSideProps = async ({ req, res, locale, query }: { req: Nex let { raids, sortedRaids } = await api.endpoints.raids .getAll({ params: headers }) - .then((response) => organizeRaids(response.data.map((r: any) => r.raid))) + .then((response) => organizeRaids(response.data)) // Extract recency filter const recencyParam: number = parseInt(query.recency) diff --git a/pages/teams.tsx b/pages/teams.tsx index fa03697c..3577f18a 100644 --- a/pages/teams.tsx +++ b/pages/teams.tsx @@ -157,12 +157,11 @@ const TeamsRoute: React.FC = (props: Props) => { // Fetch all raids on mount, then find the raid in the URL if present useEffect(() => { api.endpoints.raids.getAll().then((response) => { - const cleanRaids: Raid[] = response.data.map((r: any) => r.raid) - setRaids(cleanRaids) + setRaids(response.data) setRaidsLoading(false) - const raid = cleanRaids.find((r) => r.slug === raidSlug) + const raid = response.data.find((r: Raid) => r.slug === raidSlug) setRaid(raid) return raid @@ -356,7 +355,7 @@ export const getServerSideProps = async ({ req, res, locale, query }: { req: Nex let { raids, sortedRaids } = await api.endpoints.raids .getAll({ params: headers }) - .then((response) => organizeRaids(response.data.map((r: any) => r.raid))) + .then((response) => organizeRaids(response.data)) // Extract recency filter const recencyParam: number = parseInt(query.recency)