| | |
| | | // src/stores/useUserStore.js |
| | | import { |
| | | loginByUsername, |
| | | logout |
| | | } from '@/api/user' |
| | | import { defineStore } from 'pinia' |
| | | import md5 from 'js-md5' |
| | |
| | | userInfo.code |
| | | ) |
| | | .then(res => { |
| | | console.log(res, 122222) |
| | | const data = res.data |
| | | if (data.error_description) { |
| | | ElMessage({ |
| | |
| | | |
| | | SET_USER_INFO (userInfo) { |
| | | this.userInfo = userInfo |
| | | } |
| | | }, |
| | | |
| | | // 登出 |
| | | LogOut () { |
| | | return new Promise((resolve, reject) => { |
| | | logout() |
| | | .then(() => { |
| | | this.SET_TOKEN('') |
| | | this.SET_REFRESH_TOKEN('') |
| | | this.SET_TENANT_ID('') |
| | | this.SET_USER_INFO('') |
| | | resolve() |
| | | }) |
| | | .catch((error) => { |
| | | reject(error) |
| | | }) |
| | | }) |
| | | }, |
| | | }, |
| | | |
| | | persist: { |