ai generated solutions to our ai generated problems
This commit is contained in:
+11
-11
@@ -1186,18 +1186,22 @@ function AppContent() {
|
||||
games: { status: 'loading', data: null, error: null },
|
||||
})
|
||||
|
||||
fetchJson(apiEndpoints.detail(route.teamName), controller.signal)
|
||||
.then((detail) => {
|
||||
Promise.allSettled([
|
||||
fetchJson(apiEndpoints.detail(route.teamName), controller.signal),
|
||||
fetchJson(apiEndpoints.games(route.teamName), controller.signal),
|
||||
])
|
||||
.then(([detailResult, gamesResult]) => {
|
||||
if (controller.signal.aborted) return
|
||||
if (!teamDetailLooksReal(detail)) {
|
||||
if (detailResult.status !== 'fulfilled') {
|
||||
navigate('/teams', { replace: true })
|
||||
return
|
||||
}
|
||||
|
||||
return Promise.allSettled([
|
||||
fetchJson(apiEndpoints.games(route.teamName), controller.signal),
|
||||
]).then(([gamesResult]) => {
|
||||
if (controller.signal.aborted) return
|
||||
const detail = detailResult.value
|
||||
if (!teamDetailLooksReal(detail)) {
|
||||
navigate('/teams', { replace: true })
|
||||
return
|
||||
}
|
||||
|
||||
setProfile({
|
||||
teamName: route.teamName,
|
||||
@@ -1208,10 +1212,6 @@ function AppContent() {
|
||||
: { status: 'error', data: null, error: gamesResult.reason.message },
|
||||
})
|
||||
})
|
||||
})
|
||||
.catch(() => {
|
||||
if (!controller.signal.aborted) navigate('/teams', { replace: true })
|
||||
})
|
||||
|
||||
return () => controller.abort()
|
||||
}, [route.page, route.teamName])
|
||||
|
||||
Reference in New Issue
Block a user