Skip to content

Commit 986aede

Browse files
committed
refactor: Remove store.js and use localStorage instead (#109)
1 parent 78bedd3 commit 986aede

File tree

6 files changed

+1
-32
lines changed

6 files changed

+1
-32
lines changed

build/vite/optimize.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
const include = [
22
'axios',
3-
'store',
43
'echarts',
54
'lodash-es',
65
'resize-detector',
7-
'store/plugins/expire',
86
'vant/es/cell-group/style/index',
97
'vant/es/popup/style/index',
108
'vant/es/picker/style/index',

package.json

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828
"pinia": "^2.1.7",
2929
"pinia-plugin-persistedstate": "^3.2.1",
3030
"resize-detector": "^0.3.0",
31-
"store": "^2.0.12",
3231
"vant": "^4.9.1",
3332
"vconsole": "^3.15.1",
3433
"vue": "^3.4.30",
@@ -42,7 +41,6 @@
4241
"@types/lodash-es": "^4.17.12",
4342
"@types/node": "^20.14.8",
4443
"@types/nprogress": "^0.2.3",
45-
"@types/store": "^2.0.5",
4644
"@unocss/eslint-plugin": "0.61.0",
4745
"@unocss/preset-rem-to-px": "0.61.0",
4846
"@vitejs/plugin-legacy": "^5.4.1",

pnpm-lock.yaml

Lines changed: 0 additions & 16 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/auto-imports.d.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ declare global {
3535
const debouncedWatch: typeof import('@vueuse/core')['debouncedWatch']
3636
const defineAsyncComponent: typeof import('vue')['defineAsyncComponent']
3737
const defineComponent: typeof import('vue')['defineComponent']
38-
const definePage: typeof import('unplugin-vue-router/runtime')['definePage']
3938
const describe: typeof import('vitest')['describe']
4039
const eagerComputed: typeof import('@vueuse/core')['eagerComputed']
4140
const effectScope: typeof import('vue')['effectScope']

src/utils/local-storage.ts

Lines changed: 0 additions & 9 deletions
This file was deleted.

src/utils/request.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import type { AxiosError, InternalAxiosRequestConfig } from 'axios'
22
import axios from 'axios'
33
import { showNotify } from 'vant'
4-
import { localStorage } from '@/utils/local-storage'
54
import { STORAGE_TOKEN_KEY } from '@/stores/mutation-type'
65

76
// 这里是用于设定请求后端时,所用的 Token KEY
@@ -49,7 +48,7 @@ function errorHandler(error: RequestError): Promise<any> {
4948

5049
// 请求拦截器
5150
function requestHandler(config: InternalAxiosRequestConfig): InternalAxiosRequestConfig | Promise<InternalAxiosRequestConfig> {
52-
const savedToken = localStorage.get(STORAGE_TOKEN_KEY)
51+
const savedToken = localStorage.getItem(STORAGE_TOKEN_KEY)
5352
// 如果 token 存在
5453
// 让每个请求携带自定义 token, 请根据实际情况修改
5554
if (savedToken)

0 commit comments

Comments
 (0)