# reset devcieID if logout
This commit is contained in:
parent
23ea18dcca
commit
84070498c6
|
@ -1,6 +1,6 @@
|
|||
const counter = {
|
||||
state: {
|
||||
deviceID: '868575028779793',
|
||||
deviceID: '',
|
||||
mapClick: false
|
||||
},
|
||||
mutations: {
|
||||
|
|
|
@ -100,11 +100,12 @@ const user = {
|
|||
// },
|
||||
|
||||
// 登出
|
||||
LogOut({ commit, state }) {
|
||||
LogOut({ commit, state, rootState }) {
|
||||
return new Promise((resolve, reject) => {
|
||||
logout(state.token).then(() => {
|
||||
commit('SET_TOKEN', '')
|
||||
commit('SET_ROLES', [])
|
||||
commit('CHANGE_DEVICE_ID', '', { root: true })
|
||||
removeToken()
|
||||
resolve()
|
||||
}).catch(error => {
|
||||
|
|
|
@ -114,10 +114,17 @@ export default {
|
|||
})
|
||||
},
|
||||
getDevices(params) {
|
||||
let device_id = params.device_id
|
||||
fetchDeviceList(params).then(response => {
|
||||
this.deviceList = response.data.results
|
||||
this.lastItem = this.deviceList[0]
|
||||
console.log(typeof (this.lastItem.count))
|
||||
if (!device_id) {
|
||||
device_id = this.lastItem.device_id
|
||||
this.$store.dispatch('changeDeviceID', device_id)
|
||||
console.log(device_id)
|
||||
}
|
||||
// console.log(this.lastItem)
|
||||
this.getDeviceLogsHistory({ device_id })
|
||||
if (typeof (this.lastItem.count) === 'number') {
|
||||
this.lastItem.count = this.lastItem.count.toString()
|
||||
}
|
||||
|
@ -143,7 +150,6 @@ export default {
|
|||
},
|
||||
created() {
|
||||
const device_id = this.$store.getters.deviceID
|
||||
this.getDeviceLogsHistory({ device_id })
|
||||
this.getDevices({ device_id })
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue