Files
wireguard-ui/src/pages/auth/signup/index.server.ts
T
tbenandClaude Opus 5.5 178f98104c Fix type-check after bun-sqlite 1.2.0 upgrade
Import types from @moduletrace/bun-sqlite/types now that the package
has an exports map, and guard optional ctx.props in signup server fn.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-15 21:09:27 +01:00

26 lines
620 B
TypeScript

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<PagePropsType> = 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 {};
};