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

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