forked from elunez/eladmin
-
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.
- Loading branch information
郑杰
committed
Jan 21, 2019
1 parent
45655e2
commit 685985c
Showing
7 changed files
with
68 additions
and
63 deletions.
There are no files selected for viewing
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
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 |
---|---|---|
@@ -1,25 +1,17 @@ | ||
import Cookies from 'js-cookie' | ||
|
||
const TokenKey = 'Admin-Token' | ||
const storageTokenKey = 'EL_ADMIN_COOKIE_TOKEN' | ||
|
||
export function getToken() { | ||
return Cookies.get(TokenKey) | ||
} | ||
|
||
export function getStorageToken() { | ||
return localStorage.getItem(storageTokenKey) | ||
} | ||
|
||
export function setToken(token) { | ||
return Cookies.set(TokenKey, token) | ||
} | ||
|
||
export function setStorageToken(token) { | ||
return localStorage.setItem(storageTokenKey, token) | ||
export function setToken(token, rememberMe) { | ||
if (rememberMe) { | ||
return Cookies.set(TokenKey, token, { expires: 1 }) | ||
} else return Cookies.set(TokenKey, token) | ||
} | ||
|
||
export function removeToken() { | ||
localStorage.removeItem(storageTokenKey) | ||
return Cookies.remove(TokenKey) | ||
} |
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