Some checks failed
Build and Push Docker Images (Trusted) / build-and-push (., docker/caddy/Dockerfile, caddy) (push) Has been cancelled
Build and Push Docker Images (Trusted) / build-and-push (., docker/l4-port-manager/Dockerfile, l4-port-manager) (push) Has been cancelled
Build and Push Docker Images (Trusted) / build-and-push (., docker/web/Dockerfile, web) (push) Has been cancelled
Tests / test (push) Has been cancelled
30 lines
795 B
TypeScript
Executable File
30 lines
795 B
TypeScript
Executable File
import { requireUser } from "@/src/lib/auth";
|
|
import { getUserById } from "@/src/lib/models/user";
|
|
import { getProviderDisplayList } from "@/src/lib/models/oauth-providers";
|
|
import { listApiTokens } from "@/src/lib/models/api-tokens";
|
|
import ProfileClient from "./ProfileClient";
|
|
import { redirect } from "next/navigation";
|
|
|
|
export default async function ProfilePage() {
|
|
const session = await requireUser();
|
|
const userId = Number(session.user.id);
|
|
|
|
const user = await getUserById(userId);
|
|
if (!user) {
|
|
redirect("/login");
|
|
}
|
|
|
|
const [enabledProviders, apiTokens] = await Promise.all([
|
|
getProviderDisplayList(),
|
|
listApiTokens(userId),
|
|
]);
|
|
|
|
return (
|
|
<ProfileClient
|
|
user={user}
|
|
enabledProviders={enabledProviders}
|
|
apiTokens={apiTokens}
|
|
/>
|
|
);
|
|
}
|