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')) {