We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent ea2bd79 commit 07da3baCopy full SHA for 07da3ba
1 file changed
apps/blade/src/app/admin/forms/page.tsx
@@ -1,9 +1,23 @@
1
+import { auth } from "@forge/auth";
2
import FormsClient from "../../_components/admin/forms/homepage";
3
+import { SIGN_IN_PATH } from "~/consts";
4
+import { redirect } from "next/navigation";
5
+import { api } from "~/trpc/server";
6
7
export const metadata = {
8
title: "Forms",
9
};
10
-export default function Page() {
11
+export default async function Page() {
12
+ const session = await auth();
13
+ if (!session) {
14
+ redirect(SIGN_IN_PATH);
15
+ }
16
+
17
+ const isAdmin = await api.auth.getAdminStatus();
18
+ if (!isAdmin) {
19
+ redirect("/");
20
21
22
return <FormsClient />;
23
}
0 commit comments