diff --git a/thoughts-frontend/app/remote-actor/page.tsx b/thoughts-frontend/app/remote-actor/page.tsx index 9d6adb1..33a9405 100644 --- a/thoughts-frontend/app/remote-actor/page.tsx +++ b/thoughts-frontend/app/remote-actor/page.tsx @@ -68,7 +68,7 @@ export default async function RemoteActorPage({ const postsData = postsResult.status === "fulfilled" ? postsResult.value : null; const posts = postsData?.items ?? []; const totalPages = postsData - ? Math.ceil(postsData.total / postsData.per_page) + ? Math.ceil(postsData.total / postsData.perPage) : 1; const me = meResult.status === "fulfilled" ? (meResult.value as Me | null) : null; diff --git a/thoughts-frontend/app/users/[username]/page.tsx b/thoughts-frontend/app/users/[username]/page.tsx index c6cd491..fae875b 100644 --- a/thoughts-frontend/app/users/[username]/page.tsx +++ b/thoughts-frontend/app/users/[username]/page.tsx @@ -100,7 +100,7 @@ export default async function ProfilePage({ params }: ProfilePageProps) { const thoughtsData = thoughtsResult.status === "fulfilled" ? thoughtsResult.value : null; const thoughts = thoughtsData?.items ?? []; const totalPages = thoughtsData - ? Math.ceil(thoughtsData.total / thoughtsData.per_page) + ? Math.ceil(thoughtsData.total / thoughtsData.perPage) : 1; const localFollowersCount = diff --git a/thoughts-frontend/app/users/all/page.tsx b/thoughts-frontend/app/users/all/page.tsx index 5dd8c64..64e93e3 100644 --- a/thoughts-frontend/app/users/all/page.tsx +++ b/thoughts-frontend/app/users/all/page.tsx @@ -22,8 +22,8 @@ export default async function AllUsersPage({ ); } - const { items, total, per_page } = usersData; - const totalPages = Math.ceil(total / per_page); + const { items, total, perPage } = usersData; + const totalPages = Math.ceil(total / perPage); return (
diff --git a/thoughts-frontend/lib/api.ts b/thoughts-frontend/lib/api.ts index d876147..ad0612e 100644 --- a/thoughts-frontend/lib/api.ts +++ b/thoughts-frontend/lib/api.ts @@ -299,7 +299,7 @@ export const getRemoteActorPosts = ( z.object({ total: z.number(), page: z.number(), - per_page: z.number(), + perPage: z.number(), items: z.array(ThoughtSchema), }), token @@ -347,8 +347,8 @@ export const getAllUsers = (page: number = 1, pageSize: number = 20) => apiFetch( `/users?page=${page}&per_page=${pageSize}`, { next: { tags: ['users'] } }, - z.object({ items: z.array(UserSchema), total: z.number(), page: z.number(), per_page: z.number() }) - .transform((d) => ({ ...d, totalPages: Math.ceil(d.total / d.per_page) })) + z.object({ items: z.array(UserSchema), total: z.number(), page: z.number(), perPage: z.number() }) + .transform((d) => ({ ...d, totalPages: Math.ceil(d.total / d.perPage) })) ); export const getAllUsersCount = () => @@ -381,8 +381,8 @@ export const getFeed = (token: string, page = 1, pageSize = 20, opts: FeedOption return apiFetch( `/feed?${params.toString()}`, { next: { tags: ["feed"] } }, - z.object({ items: z.array(ThoughtSchema), total: z.number(), page: z.number(), per_page: z.number() }) - .transform((d) => ({ ...d, totalPages: Math.ceil(d.total / d.per_page) })), + z.object({ items: z.array(ThoughtSchema), total: z.number(), page: z.number(), perPage: z.number() }) + .transform((d) => ({ ...d, totalPages: Math.ceil(d.total / d.perPage) })), token ); }; @@ -391,7 +391,7 @@ export const getUserThoughts = (username: string, token: string | null, page = 1 apiFetch( `/users/${username}/thoughts?page=${page}`, { next: { tags: [`profile:${username}`] } }, - z.object({ items: z.array(ThoughtSchema), total: z.number(), page: z.number(), per_page: z.number() }), + z.object({ items: z.array(ThoughtSchema), total: z.number(), page: z.number(), perPage: z.number() }), token ); @@ -427,7 +427,7 @@ export const getThoughtsByTag = (tagName: string, token: string | null) => apiFetch( `/tags/${tagName}`, { next: { tags: [`tag:${tagName}`, 'feed'] } }, - z.object({ tag: z.string(), items: z.array(ThoughtSchema), total: z.number(), page: z.number(), per_page: z.number() }), + z.object({ items: z.array(ThoughtSchema), total: z.number(), page: z.number(), perPage: z.number() }), token );