-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Feature/BAR-238] 최근 로그인 정보 반영 (#68)
* feat: 최근 로그인 정보 반영하기 * refactor: storage key 상수화
- Loading branch information
Showing
8 changed files
with
125 additions
and
50 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
export const STORAGE_KEY = { | ||
ACCESS_TOKEN: 'accessToken', | ||
REFRESH_TOKEN: 'refreshToken', | ||
RECENT_LOGIN_TYPE: 'recentLoginType', | ||
} as const; |
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 |
---|---|---|
@@ -1,11 +1,13 @@ | ||
import Cookies from 'js-cookie'; | ||
|
||
import { STORAGE_KEY } from '@models/storage'; | ||
|
||
interface SaveTokenParams { | ||
accessToken: string; | ||
refreshToken: string; | ||
} | ||
|
||
export const saveToken = ({ accessToken, refreshToken }: SaveTokenParams) => { | ||
localStorage.setItem('accessToken', accessToken); | ||
Cookies.set('refreshToken', refreshToken); | ||
localStorage.setItem(STORAGE_KEY.ACCESS_TOKEN, accessToken); | ||
Cookies.set(STORAGE_KEY.REFRESH_TOKEN, refreshToken); | ||
}; |