diff --git a/src/components/ShowFile/ShowFile.vue b/src/components/ShowFile/ShowFile.vue index 38a2523..c59447e 100644 --- a/src/components/ShowFile/ShowFile.vue +++ b/src/components/ShowFile/ShowFile.vue @@ -2752,8 +2752,7 @@ export default { this.vmode }&path=${path}${keyword}${searchOpenFolder}${queryTagId}${basePath}${folder}` ) - api - .searchFile({ + api.searchFile({ userId: this.$store.state.user.userId, username: this.$store.state.user.name, keyword: key, @@ -2768,11 +2767,12 @@ export default { pageIndex: this.pagination.pageIndex, pageSize: this.pagination.pageSize, showFolderSize: localStorage.getItem('showFolderSize'), - }) - .then(res => { + }).then(res => { this.loadData(res, onLoad) this.listModeSearch = true this.listModeSearchOpenDir = false + }).catch(() => { + this.tableLoading = false }) } else { if (this.listModeSearch) { @@ -2811,7 +2811,9 @@ export default { this.loadData(res, onLoad) this.listModeSearch = true this.listModeSearchOpenDir = fileId - }) + }).catch(() => { + this.tableLoading = false + }) }, openDir(row, onLoad) { this.beforeLoadData(onLoad) @@ -2828,6 +2830,8 @@ export default { }) .then(res => { this.loadData(res, onLoad) + }).catch(() => { + this.tableLoading = false }) // this.path = row.path + row.name // this.path = this.path.replace(/\\/g, '/') @@ -2867,7 +2871,9 @@ export default { }) .then(res => { this.loadData(res, onLoad) - }) + }).catch(() => { + this.tableLoading = false + }) } }, getQueryPath() { diff --git a/src/store/modules/user.js b/src/store/modules/user.js index c01560e..75c10f0 100644 --- a/src/store/modules/user.js +++ b/src/store/modules/user.js @@ -206,6 +206,12 @@ const actions = { }) }, + // update token + setToken({ commit }, jmalToken) { + commit('SET_TOKEN', jmalToken) + console.log('jmalToken', jmalToken) + }, + // remove share token resetShareToken({ commit }) { return new Promise(resolve => { diff --git a/src/utils/request.js b/src/utils/request.js index 6fb59f1..8febd08 100644 --- a/src/utils/request.js +++ b/src/utils/request.js @@ -79,6 +79,10 @@ service.interceptors.response.use( location.reload() }) }) + } else { + store.dispatch('user/resetToken').then(() => { + location.reload() + }) } }, 200) } else { @@ -90,6 +94,9 @@ service.interceptors.response.use( } return Promise.reject() } else { + if (response.headers['jmal-token']) { + store.dispatch('user/setToken', response.headers['jmal-token']) + } let message = '' if (res.message) { message = res.message.toString()