You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

19 lines
644 B

2 years ago
import Cookies from 'js-cookie'
2 years ago
import router from '@/router'
2 years ago
const TokenKey = 'difficult_employee_token'
const TokenKsy_h5 = 'difficult_employee_token_h5'
2 years ago
export function getToken(tokenName) {
2 years ago
let flag = /\/h5.*/.test(window.location.href)
2 years ago
return Cookies.get(tokenName ? tokenName : (flag ? TokenKsy_h5 : TokenKey))
2 years ago
}
2 years ago
export function setToken(token, tokenName) {
2 years ago
let flag = /\/h5.*/.test(window.location.href)
2 years ago
return Cookies.set(tokenName ? tokenName : (flag ? TokenKsy_h5 : TokenKey), token)
2 years ago
}
export function removeToken() {
2 years ago
let flag = /\/h5.*/.test(window.location.href)
2 years ago
return Cookies.remove(flag ? TokenKsy_h5 : TokenKey)
2 years ago
}