import grabUsers from "@/src/functions/backend/db/users/grab-users"; import type { PagePropsType } from "@/src/types"; import type { BunextPageServerFn } from "@moduletrace/bunext/types"; export const server: BunextPageServerFn = async (ctx) => { if (ctx.props?.user?.id) { return { redirect: { destination: `/admin`, }, }; } const users_res = await grabUsers(); if (users_res.singleRes?.id) { return { redirect: { destination: `/auth/login`, }, }; } return {}; };