File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1- export default function Layout ( { children } : { children : React . ReactNode } ) {
1+ import { getMe } from "@/lib/auth/auth.server" ;
2+ import { redirect } from "next/navigation" ;
3+
4+ export default async function Layout ( { children } : { children : React . ReactNode } ) {
5+ let isLoggedIn = false ;
6+
7+ try {
8+ await getMe ( ) ;
9+ isLoggedIn = true ;
10+ } catch { }
11+
12+ if ( isLoggedIn ) {
13+ redirect ( "/home" ) ;
14+ }
15+
216 return (
317 < div className = "grid min-h-screen grid-cols-2" >
418 { /* TODO: 왼쪽 이미지 */ }
Original file line number Diff line number Diff line change 1- export default function Layout ( { children } : { children : React . ReactNode } ) {
1+ import { getMe } from "@/lib/auth/auth.server" ;
2+ import { redirect } from "next/navigation" ;
3+
4+ export default async function Layout ( { children } : { children : React . ReactNode } ) {
5+ let isLoggedIn = false ;
6+
7+ try {
8+ await getMe ( ) ;
9+ isLoggedIn = true ;
10+ } catch { }
11+
12+ if ( ! isLoggedIn ) {
13+ redirect ( "/sign-in" ) ;
14+ }
15+
216 return < > { children } </ > ;
317}
You can’t perform that action at this time.
0 commit comments