Skip to content

Commit d024e69

Browse files
committed
Reuse apiSchema for the same API
1 parent ed81bef commit d024e69

File tree

1 file changed

+1
-18
lines changed

1 file changed

+1
-18
lines changed

frontend/app/routes/posts/classic.tsx

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -11,28 +11,11 @@ import SwitchLoadingModes from "~/routes/posts/components/SwitchLoadingModes"
1111
import {useApplicationContext} from "~/layouts/useApplicationContext"
1212
import {z} from "zod/v4"
1313
import PostsTable from "./components/PostsTable"
14+
import {apiSchema} from "./home"
1415

1516
/*
1617
* This page uses page-tailored APIs
1718
* */
18-
export const apiSchema = z.strictObject({
19-
posts: z.array(z.strictObject({
20-
id: z.number(),
21-
content: z.string(),
22-
author: z.strictObject({
23-
email: z.string(),
24-
}),
25-
highlighted: z.boolean(),
26-
canEditPost: z.boolean(),
27-
createdAt: z.iso.datetime({offset: true}).transform((date) => new Date(date)),
28-
})),
29-
pagination: z.strictObject({
30-
prevPage: z.number().nullable(),
31-
nextPage: z.number().nullable()
32-
}),
33-
permissions: z.strictObject({canCreatePost: z.boolean()})
34-
});
35-
3619
export async function clientLoader({params}: Route.ClientLoaderArgs) {
3720
return null
3821
}

0 commit comments

Comments
 (0)