From 0809bed2f3ff69870b9a59ef6de60ea5ab05b749 Mon Sep 17 00:00:00 2001 From: Baozier Date: Thu, 26 Dec 2024 12:41:55 -0500 Subject: [PATCH] Add an example for implementation with NextAuth (#204) --- .gitignore | 1 + .../app/[lang]/users/[authId]/page.tsx | 2 +- admin-panel/package-lock.json | 9802 +++++++++-------- admin-panel/package.json | 4 +- admin-panel/vitest.config.mts | 2 +- admin-panel/wrangler.toml | 2 +- examples/next-auth-js-example/next-auth.d.ts | 24 + examples/next-auth-js-example/next.config.ts | 5 + .../next-auth-js-example/package-lock.json | 1114 ++ examples/next-auth-js-example/package.json | 23 + .../src/app/api/auth/[...nextauth]/route.ts | 69 + .../src/app/dashboard/layout.tsx | 14 + .../src/app/dashboard/page.tsx | 47 + .../next-auth-js-example/src/app/layout.tsx | 11 + .../src/app/server-dashboard/page.tsx | 33 + .../src/app/sign-in/page.tsx | 41 + examples/next-auth-js-example/tsconfig.json | 25 + package-lock.json | 32 +- server/src/services/jwt.ts | 1 + server/vitest.config.mts | 2 +- shared/src/clientInterface.ts | 1 + 21 files changed, 6356 insertions(+), 4899 deletions(-) create mode 100644 examples/next-auth-js-example/next-auth.d.ts create mode 100644 examples/next-auth-js-example/next.config.ts create mode 100644 examples/next-auth-js-example/package-lock.json create mode 100644 examples/next-auth-js-example/package.json create mode 100644 examples/next-auth-js-example/src/app/api/auth/[...nextauth]/route.ts create mode 100644 examples/next-auth-js-example/src/app/dashboard/layout.tsx create mode 100644 examples/next-auth-js-example/src/app/dashboard/page.tsx create mode 100644 examples/next-auth-js-example/src/app/layout.tsx create mode 100644 examples/next-auth-js-example/src/app/server-dashboard/page.tsx create mode 100644 examples/next-auth-js-example/src/app/sign-in/page.tsx create mode 100644 examples/next-auth-js-example/tsconfig.json diff --git a/.gitignore b/.gitignore index eeb1e189..9cf72b2c 100644 --- a/.gitignore +++ b/.gitignore @@ -7,6 +7,7 @@ docs/.vuepress/.temp .next/ .expo expo-env.d.ts +next-env.d.ts .open-next .dev.vars diff --git a/admin-panel/app/[lang]/users/[authId]/page.tsx b/admin-panel/app/[lang]/users/[authId]/page.tsx index df3a0e77..b7506b74 100644 --- a/admin-panel/app/[lang]/users/[authId]/page.tsx +++ b/admin-panel/app/[lang]/users/[authId]/page.tsx @@ -556,7 +556,7 @@ const Page = () => { id={`role-${role.id}`} data-testid='roleInput' onChange={() => handleToggleUserRole(role.name)} - checked={userRoles?.includes(role.name)} + checked={userRoles?.includes(role.name) ?? false} />