From d3673e431e97541cba6c9eab68fc612af53a6778 Mon Sep 17 00:00:00 2001 From: pany <939630029@qq.com> Date: Thu, 25 May 2023 09:22:10 +0800 Subject: perf: 代码优化 统一 constants 目录下文件名风格 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/constants/cache-key.ts | 10 ++++++++++ src/constants/cacheKey.ts | 10 ---------- src/utils/cache/cookies.ts | 2 +- src/utils/cache/localStorage.ts | 2 +- 4 files changed, 12 insertions(+), 12 deletions(-) create mode 100644 src/constants/cache-key.ts delete mode 100644 src/constants/cacheKey.ts diff --git a/src/constants/cache-key.ts b/src/constants/cache-key.ts new file mode 100644 index 0000000..e1f0692 --- /dev/null +++ b/src/constants/cache-key.ts @@ -0,0 +1,10 @@ +const SYSTEM_NAME = "v3-admin-vite" + +/** 缓存数据时用到的 Key */ +class CacheKey { + static readonly TOKEN = `${SYSTEM_NAME}-token-key` + static readonly SIDEBAR_STATUS = `${SYSTEM_NAME}-sidebar-status-key` + static readonly ACTIVE_THEME_NAME = `${SYSTEM_NAME}-active-theme-name-key` +} + +export default CacheKey diff --git a/src/constants/cacheKey.ts b/src/constants/cacheKey.ts deleted file mode 100644 index e1f0692..0000000 --- a/src/constants/cacheKey.ts +++ /dev/null @@ -1,10 +0,0 @@ -const SYSTEM_NAME = "v3-admin-vite" - -/** 缓存数据时用到的 Key */ -class CacheKey { - static readonly TOKEN = `${SYSTEM_NAME}-token-key` - static readonly SIDEBAR_STATUS = `${SYSTEM_NAME}-sidebar-status-key` - static readonly ACTIVE_THEME_NAME = `${SYSTEM_NAME}-active-theme-name-key` -} - -export default CacheKey diff --git a/src/utils/cache/cookies.ts b/src/utils/cache/cookies.ts index 537d6c6..21d938f 100644 --- a/src/utils/cache/cookies.ts +++ b/src/utils/cache/cookies.ts @@ -1,6 +1,6 @@ /** 统一处理 Cookie */ -import CacheKey from "@/constants/cacheKey" +import CacheKey from "@/constants/cache-key" import Cookies from "js-cookie" export const getToken = () => { diff --git a/src/utils/cache/localStorage.ts b/src/utils/cache/localStorage.ts index db03729..7b601ef 100644 --- a/src/utils/cache/localStorage.ts +++ b/src/utils/cache/localStorage.ts @@ -1,6 +1,6 @@ /** 统一处理 localStorage */ -import CacheKey from "@/constants/cacheKey" +import CacheKey from "@/constants/cache-key" import { type SidebarOpened, type SidebarClosed } from "@/constants/app-key" import { type ThemeName } from "@/hooks/useTheme" -- cgit v1.2.3