Skip to content

Commit

Permalink
feat: redirect to dashboard when the user is signed in for sign up an…
Browse files Browse the repository at this point in the history
…d sign in page
  • Loading branch information
ixartz committed Aug 10, 2023
1 parent 45ed137 commit 629a033
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/app/(auth)/(center)/layout.tsx
@@ -1,8 +1,18 @@
import { auth } from '@clerk/nextjs';
import { redirect } from 'next/navigation';
import React from 'react';

export default function CenteredLayout({
children, // will be a page or nested layout
}: {
children: React.ReactNode;
}) {
const { userId } = auth();

if (userId) {
redirect('/dashboard');
}

return (
<div className="flex min-h-screen items-center justify-center">
{children}
Expand Down

0 comments on commit 629a033

Please sign in to comment.