From c635d78b479510ebe2556a420948effcd30a0731 Mon Sep 17 00:00:00 2001 From: skyouc Date: 星期六, 21 十二月 2024 18:40:43 +0800 Subject: [PATCH] 新建德森项目分支 --- zy-asrs-flow/src/utils/token-util.ts | 78 +++++++++++++++++++------------------- 1 files changed, 39 insertions(+), 39 deletions(-) diff --git a/zy-asrs-flow/src/utils/token-util.ts b/zy-asrs-flow/src/utils/token-util.ts index 48cbaf2..94ddbe8 100644 --- a/zy-asrs-flow/src/utils/token-util.ts +++ b/zy-asrs-flow/src/utils/token-util.ts @@ -1,39 +1,39 @@ -/** - * token 鎿嶄綔灏佽 - */ -import { TOKEN_STORE_NAME } from '@/config/setting'; - -/** - * 鑾峰彇缂撳瓨鐨� token - */ -export function getToken(): string | null { - const token = localStorage.getItem(TOKEN_STORE_NAME); - if (!token) { - return sessionStorage.getItem(TOKEN_STORE_NAME); - } - return token; -} - -/** - * 缂撳瓨 token - * @param token token - * @param remember 鏄惁姘镐箙瀛樺偍 - */ -export function setToken(token?: string, remember?: boolean) { - removeToken(); - if (token) { - if (remember) { - localStorage.setItem(TOKEN_STORE_NAME, token); - } else { - sessionStorage.setItem(TOKEN_STORE_NAME, token); - } - } -} - -/** - * 绉婚櫎 token - */ -export function removeToken() { - localStorage.removeItem(TOKEN_STORE_NAME); - sessionStorage.removeItem(TOKEN_STORE_NAME); -} +/** + * token 鎿嶄綔灏佽 + */ +import { TOKEN_STORE_NAME } from '@/config/setting'; + +/** + * 鑾峰彇缂撳瓨鐨� token + */ +export function getToken(): string | null { + const token = localStorage.getItem(TOKEN_STORE_NAME); + if (!token) { + return sessionStorage.getItem(TOKEN_STORE_NAME); + } + return token; +} + +/** + * 缂撳瓨 token + * @param token token + * @param remember 鏄惁姘镐箙瀛樺偍 + */ +export function setToken(token?: string, remember?: boolean) { + removeToken(); + if (token) { + if (remember) { + localStorage.setItem(TOKEN_STORE_NAME, token); + } else { + sessionStorage.setItem(TOKEN_STORE_NAME, token); + } + } +} + +/** + * 绉婚櫎 token + */ +export function removeToken() { + localStorage.removeItem(TOKEN_STORE_NAME); + sessionStorage.removeItem(TOKEN_STORE_NAME); +} -- Gitblit v1.9.1