| | |
| | | import { getToken, setToken, removeToken } from "@/utils/auth"; |
| | | import defAva from "@/static/images/profile.jpg"; |
| | | import { defineStore } from "pinia"; |
| | | import config from '@/config.js' |
| | | |
| | | export interface LoginForm { |
| | | username: string; |
| | |
| | | .then((res: any) => { |
| | | const user = res.user |
| | | let avatar = user.avatar || "" |
| | | avatar = import.meta.env.VITE_APP_BASE_API + '/profile/' + avatar |
| | | avatar = config.baseUrl + '/profile/' + avatar |
| | | if (res.roles && res.roles.length > 0) { // 验证返回的roles是否是一个非空数组 |
| | | this.roles = res.roles |
| | | this.permissions = res.permissions |