-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #81 from YAPP-Github/feat/MAFOO-92
[feat/MAFOO-92] 로그인 토큰 기간 정의 및 서버에서 쿠키 관리
- Loading branch information
Showing
18 changed files
with
118 additions
and
87 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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
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
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
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
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
This file was deleted.
Oops, something went wrong.
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,14 @@ | ||
"use client" | ||
|
||
import { SessionProvider } from "next-auth/react" | ||
import React from "react" | ||
|
||
interface Props { | ||
children: React.ReactNode | ||
} | ||
|
||
const NextAuthProvider = ({ children }: Props) => { | ||
return <SessionProvider>{children}</SessionProvider> | ||
} | ||
|
||
export default NextAuthProvider |
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
This file was deleted.
Oops, something went wrong.
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,14 @@ | ||
"use client" | ||
|
||
import Alert from "../../common/Alert" | ||
import useAlertStore from "./useAlertStore" | ||
|
||
const AlertProvider = () => { | ||
const { title, description, visible, hideAlert } = useAlertStore() | ||
|
||
if (!visible) return null | ||
|
||
return <Alert title={title} description={description} onClose={hideAlert} /> | ||
} | ||
|
||
export default AlertProvider |
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,2 @@ | ||
export { default as AlertProvider } from "./AlertProvider" | ||
export { default as useAlertStore } from "./useAlertStore" |
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 { create } from "zustand" | ||
|
||
interface AlertState { | ||
title: string | ||
description: string | ||
visible: boolean | ||
showAlert: (title: string, description: string) => void | ||
hideAlert: () => void | ||
} | ||
|
||
const useAlertStore = create<AlertState>((set) => ({ | ||
title: "", | ||
description: "", | ||
visible: false, | ||
showAlert: (title: string, description: string) => | ||
set({ title, description, visible: true }), | ||
hideAlert: () => set({ visible: false }), | ||
})) | ||
|
||
export default useAlertStore |
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,19 @@ | ||
"use client" | ||
|
||
import useAuthStore from "./useAuthStore" | ||
|
||
interface AuthContextProps { | ||
accessToken: string | null | ||
} | ||
|
||
const AuthProvider = ({ accessToken }: AuthContextProps) => { | ||
const setAccessToken = useAuthStore((state) => state.setAccessToken) | ||
|
||
if (accessToken) { | ||
setAccessToken(accessToken) | ||
} | ||
|
||
return null | ||
} | ||
|
||
export default AuthProvider |
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,2 @@ | ||
export { default as AuthProvider } from "./AuthProvider" | ||
export { default as useAuthStore } from "./useAuthStore" |
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,15 @@ | ||
import { create } from "zustand" | ||
|
||
interface AuthState { | ||
accessToken: string | null | ||
setAccessToken: (token: string | null) => void | ||
clearAuth: () => void | ||
} | ||
|
||
const useAuthStore = create<AuthState>((set) => ({ | ||
accessToken: null, | ||
setAccessToken: (token) => set({ accessToken: token }), | ||
clearAuth: () => set({ accessToken: null }), | ||
})) | ||
|
||
export default useAuthStore |