Skip to content

Commit a07d6eb

Browse files
committed
fix: note 404
1 parent a8018dd commit a07d6eb

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/app/notes/page.tsx

+9-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import type { NoteWrappedPayload } from '@mx-space/api-client'
22

3+
import { NotFound404 } from '~/components/common/404'
34
import { apiClient } from '~/lib/request'
45

56
import Redirect from './redirect'
@@ -11,7 +12,14 @@ export default async function Page() {
1112
next: {
1213
revalidate: 30,
1314
},
14-
}).then((res) => res.json() as Promise<NoteWrappedPayload>)
15+
})
16+
.then((res) => res.json() as Promise<NoteWrappedPayload>)
17+
.catch(() => {
18+
return null
19+
})
1520

21+
if (!data || !data.data) {
22+
return <NotFound404 />
23+
}
1624
return <Redirect nid={data.data?.nid} />
1725
}

0 commit comments

Comments
 (0)