From 8021e1413b71585257db48f513b4cbfa9f570eac Mon Sep 17 00:00:00 2001 From: jmal Date: Tue, 7 Mar 2023 18:06:30 +0800 Subject: [PATCH] =?UTF-8?q?:bug:=20=E6=89=93=E5=BC=80=E5=85=AC=E5=BC=80?= =?UTF-8?q?=E7=9A=84=E5=85=B1=E4=BA=AB=E9=93=BE=E6=8E=A5=E6=97=B6=E6=B8=85?= =?UTF-8?q?=E9=99=A4shareToken?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/store/modules/user.js | 11 ++++++++++- src/utils/auth.js | 4 ++++ src/views/public/share/shareList.vue | 7 +++++-- 3 files changed, 19 insertions(+), 3 deletions(-) diff --git a/src/store/modules/user.js b/src/store/modules/user.js index e437473..44559ec 100644 --- a/src/store/modules/user.js +++ b/src/store/modules/user.js @@ -11,7 +11,7 @@ import { setRememberName, removeRememberName, setShareToken, - getShareToken + getShareToken, removeShareToken } from '@/utils/auth' import { setLogo } from '@/utils/logo' import { resetRouter } from '@/router' @@ -184,6 +184,15 @@ const actions = { commit('RESET_STATE') resolve() }) + }, + + // remove share token + resetShareToken({ commit }) { + return new Promise(resolve => { + removeShareToken() + commit('SET_SHARE_TOKEN', undefined) + resolve() + }) } } diff --git a/src/utils/auth.js b/src/utils/auth.js index 0a22ca1..b18357a 100644 --- a/src/utils/auth.js +++ b/src/utils/auth.js @@ -37,6 +37,10 @@ export function removeToken() { return Cookies.remove(tokenKey) } +export function removeShareToken() { + return Cookies.remove(shareTokenKey) +} + export function getConsumerId() { return Cookies.get(consumerId) } diff --git a/src/views/public/share/shareList.vue b/src/views/public/share/shareList.vue index d4e7e83..ee771aa 100644 --- a/src/views/public/share/shareList.vue +++ b/src/views/public/share/shareList.vue @@ -277,6 +277,7 @@ import Clipboard from "clipboard"; import OfficePreview from "@/components/preview/OfficePreview"; import Logo from "@/components/Logo"; import getPageTitle from "@/utils/get-page-title"; +import store from "@/store"; export default { components: { @@ -620,7 +621,9 @@ export default { this.getSharer(userId) } if (this.fileList.length > 0) { - this.loadShareFileList(pagination, overload, res.count) + store.dispatch('user/resetShareToken').then(() => { + this.loadShareFileList(pagination, overload, res.count) + }) } } }).catch(() => { @@ -988,7 +991,7 @@ export default { item['index'] = this.pathList.length this.pathList.push(item) this.pagination.pageIndex = 1 - this.$router.push(`/s?s=${this.shareId}&vmode=${this.vmode}`) + this.$router.push(`?s=${this.shareId}&vmode=${this.vmode}`) this.accessShareOpenDir(row.id) } else { if (row.contentType.startsWith('image')) {