kofi-stack-template-generator 2.0.15 → 2.0.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.turbo/turbo-build.log +6 -6
- package/dist/index.js +616 -56
- package/package.json +8 -8
- package/src/generator.ts +32 -3
- package/src/templates.generated.ts +17 -9
- package/templates/convex/_env.local.hbs +31 -5
- package/templates/convex/convex/auth.ts.hbs +28 -1
- package/templates/convex/convex/users.ts.hbs +12 -0
- package/templates/convex/package.json.hbs +7 -1
- package/templates/marketing/payload/_env.local.hbs +7 -7
- package/templates/web/src/app/(auth)/layout.tsx.hbs +13 -0
- package/templates/web/src/app/(auth)/sign-in/page.tsx.hbs +5 -0
- package/templates/web/src/app/(auth)/sign-up/page.tsx.hbs +5 -0
- package/templates/web/src/app/page.tsx.hbs +101 -47
- package/templates/web/src/components/auth/sign-in-form.tsx.hbs +121 -0
- package/templates/web/src/components/auth/sign-up-form.tsx.hbs +141 -0
- package/templates/web/src/components/dashboard/app-sidebar.tsx.hbs +163 -0
- package/templates/web/src/components/dashboard/dashboard-layout.tsx.hbs +38 -0
- package/templates/web/src/lib/auth.ts.hbs +13 -3
- package/templates/web/src/proxy.ts.hbs +21 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import {
|
|
2
|
+
convexAuthNextjsProxy,
|
|
3
|
+
createRouteMatcher,
|
|
4
|
+
nextjsProxyRedirect,
|
|
5
|
+
} from '@convex-dev/auth/nextjs/server'
|
|
6
|
+
|
|
7
|
+
const isPublicRoute = createRouteMatcher(['/sign-in', '/sign-up'])
|
|
8
|
+
|
|
9
|
+
export default convexAuthNextjsProxy(async (request, { convexAuth }) => {
|
|
10
|
+
const isAuthenticated = await convexAuth.isAuthenticated()
|
|
11
|
+
|
|
12
|
+
// Redirect unauthenticated users to /sign-up
|
|
13
|
+
if (!isPublicRoute(request) && !isAuthenticated) {
|
|
14
|
+
return nextjsProxyRedirect(request, '/sign-up')
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
// Redirect authenticated users from auth pages to / (dashboard)
|
|
18
|
+
if (isPublicRoute(request) && isAuthenticated) {
|
|
19
|
+
return nextjsProxyRedirect(request, '/')
|
|
20
|
+
}
|
|
21
|
+
})
|