-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a21479a
commit 4cd7691
Showing
5 changed files
with
101 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
'use client'; | ||
|
||
import { useEffect } from 'react'; | ||
import useUserStore from '@/store/useUsersStore'; | ||
import { useRouter } from 'next/navigation'; | ||
import { childrenProps } from '@/lib/type'; | ||
|
||
const RequiredAuth = ({ children }: childrenProps) => { | ||
const { user } = useUserStore(); | ||
const router = useRouter(); | ||
|
||
useEffect(() => { | ||
if (!user) { | ||
alert('로그인 해주세요.'); | ||
router.replace('/'); | ||
} | ||
}, [user, router]); | ||
return user ? children : null; | ||
}; | ||
|
||
export default RequiredAuth; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import type { PropsWithChildren } from 'react'; | ||
import type { Metadata } from 'next'; | ||
import { getMetadata } from '@/lib/util/getMetaData'; | ||
import RequiredAuth from '@/app/RequiredAuth'; | ||
|
||
export const generateMetadata = async (): Promise<Metadata> => { | ||
return getMetadata({ | ||
title: `포케허브 | 카드제작`, | ||
}); | ||
}; | ||
|
||
const CardEditLayout = ({ children }: PropsWithChildren) => { | ||
return ( | ||
<RequiredAuth> | ||
<div>{children}</div> | ||
</RequiredAuth> | ||
); | ||
}; | ||
|
||
export default CardEditLayout; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import type { PropsWithChildren } from 'react'; | ||
import type { Metadata } from 'next'; | ||
import { getMetadata } from '@/lib/util/getMetaData'; | ||
import RequiredAuth from '@/app/RequiredAuth'; | ||
|
||
export const generateMetadata = async (): Promise<Metadata> => { | ||
return getMetadata({ | ||
title: `포케허브 | 게시물 작성`, | ||
}); | ||
}; | ||
|
||
const AddLayout = ({ children }: PropsWithChildren) => { | ||
return ( | ||
<RequiredAuth> | ||
<div>{children}</div> | ||
</RequiredAuth> | ||
); | ||
}; | ||
|
||
export default AddLayout; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import type { PropsWithChildren } from 'react'; | ||
import type { Metadata } from 'next'; | ||
import { getMetadata } from '@/lib/util/getMetaData'; | ||
import RequiredAuth from '@/app/RequiredAuth'; | ||
|
||
export const generateMetadata = async (): Promise<Metadata> => { | ||
return getMetadata({ | ||
title: `포케허브 | 게시물 수정`, | ||
}); | ||
}; | ||
|
||
const EditLayout = ({ children }: PropsWithChildren) => { | ||
return ( | ||
<RequiredAuth> | ||
<div>{children}</div> | ||
</RequiredAuth> | ||
); | ||
}; | ||
|
||
export default EditLayout; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import type { PropsWithChildren } from 'react'; | ||
import type { Metadata } from 'next'; | ||
import { getMetadata } from '@/lib/util/getMetaData'; | ||
import RequiredAuth from '@/app/RequiredAuth'; | ||
|
||
export const generateMetadata = async (): Promise<Metadata> => { | ||
return getMetadata({ | ||
title: `포케허브 | 마이페이지`, | ||
}); | ||
}; | ||
|
||
const MypageLayout = ({ children }: PropsWithChildren) => { | ||
return ( | ||
<RequiredAuth> | ||
<div>{children}</div> | ||
</RequiredAuth> | ||
); | ||
}; | ||
|
||
export default MypageLayout; |