Skip to content

Commit ac2538f

Browse files
committed
Update logout action and check update function
1 parent aadc0f9 commit ac2538f

File tree

4 files changed

+6
-4
lines changed

4 files changed

+6
-4
lines changed

src/renderer/main.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import router from './router'
77
import store from './store'
88
import i18n from './i18n'
99

10-
localStorage.clear()
10+
store.dispatch('Logout')
1111

1212
Vue.config.productionTip = false
1313

src/renderer/store/index.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ export default new Vuex.Store({
4646
state.transmission_key = data.transmission_key.substr(0, 32)
4747
state.user = data
4848

49+
localStorage.email = payload.email
4950
localStorage.access_token = state.access_token
5051
localStorage.refresh_token = state.refresh_token
5152
if (process.env.NODE_ENV !== 'production') {
@@ -65,7 +66,8 @@ export default new Vuex.Store({
6566
state.transmission_key = null
6667
state.master_hash = null
6768
state.user = null
68-
localStorage.clear()
69+
const lsKeys = Object.keys(localStorage).filter(key => ['email'].includes(key) === false)
70+
lsKeys.forEach(key => localStorage.removeItem(key))
6971
},
7072

7173
async Import(_, data) {

src/renderer/views/Auth/Login.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ export default {
4747
data() {
4848
return {
4949
LoginForm: {
50-
email: '',
50+
email: localStorage.email || '',
5151
master_password: ''
5252
}
5353
}

src/renderer/views/Home/Sidebar/index.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ export default {
145145
async checkUpdate() {
146146
const { version } = require('../../../../../package.json')
147147
try {
148-
const { data } = await HTTPClient.get('/web/check-update/1')
148+
const { data } = await HTTPClient.get('/web/check-update/1', {}, { Authorization: null })
149149
150150
this.hasUpdate = data.latest_version != version
151151
this.updateLink = data.download_url

0 commit comments

Comments
 (0)