add sign in redirect
This commit is contained in:
@@ -1,14 +1,26 @@
|
|||||||
import type { Metadata } from 'next';
|
import type { Metadata } from 'next';
|
||||||
|
import { redirect } from 'next/navigation';
|
||||||
|
import { isAuthenticatedNextjs } from '@convex-dev/auth/nextjs/server';
|
||||||
|
|
||||||
export const generateMetadata = (): Metadata => {
|
export const generateMetadata = (): Metadata => {
|
||||||
return {
|
return {
|
||||||
title: 'Profile',
|
title: 'Profile',
|
||||||
|
robots: {
|
||||||
|
index: false,
|
||||||
|
follow: false,
|
||||||
|
googleBot: {
|
||||||
|
index: false,
|
||||||
|
follow: false,
|
||||||
|
},
|
||||||
|
},
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
const ProfileLayout = ({
|
const ProfileLayout = async ({
|
||||||
children,
|
children,
|
||||||
}: Readonly<{ children: React.ReactNode }>) => {
|
}: Readonly<{ children: React.ReactNode }>) => {
|
||||||
|
if (!(await isAuthenticatedNextjs()))
|
||||||
|
redirect('/sign-in');
|
||||||
return <>{children}</>;
|
return <>{children}</>;
|
||||||
};
|
};
|
||||||
export default ProfileLayout;
|
export default ProfileLayout;
|
||||||
|
|||||||
Reference in New Issue
Block a user