diff --git a/src/layout/components/tags/index.vue b/src/layout/components/tags/index.vue index 81e2392..df13f1b 100644 --- a/src/layout/components/tags/index.vue +++ b/src/layout/components/tags/index.vue @@ -2,10 +2,10 @@
@@ -18,12 +18,12 @@ diff --git a/src/store/modules/tag.js b/src/store/modules/tags/index.js similarity index 58% rename from src/store/modules/tag.js rename to src/store/modules/tags/index.js index a16ce0c..ef8aa52 100644 --- a/src/store/modules/tag.js +++ b/src/store/modules/tags/index.js @@ -1,22 +1,26 @@ import { defineStore } from 'pinia' +import { tagsSS, activeTag, tags } from './helpers' -export const useTagStore = defineStore('tag', { +export const useTagsStore = defineStore('tag', { state() { return { - tags: [], - activeTag: '', + tags: tags || [], + activeTag: activeTag || '', } }, actions: { setActiveTag(path) { this.activeTag = path + tagsSS.set('activeTag', path) }, addTag(tag = {}) { if (this.tags.some((item) => item.path === tag.path)) return this.tags.push(tag) + tagsSS.set('tags', this.tags) }, removeTag(path) { this.tags = this.tags.filter((tag) => tag.path !== path) + tagsSS.set('tags', this.tags) }, }, }) diff --git a/src/utils/http/help.js b/src/utils/http/helpers.js similarity index 100% rename from src/utils/http/help.js rename to src/utils/http/helpers.js diff --git a/src/utils/http/interceptors.js b/src/utils/http/interceptors.js index 0d1a538..6ef2ef6 100644 --- a/src/utils/http/interceptors.js +++ b/src/utils/http/interceptors.js @@ -1,6 +1,6 @@ import { router } from '@/router' import { getToken, removeToken } from '@/utils/token' -import { isWithoutToken } from './help' +import { isWithoutToken } from './helpers' export function setupInterceptor(service) { service.interceptors.request.use(