| | |
| | | import defAva from '@/assets/images/profile.jpg' |
| | | import Cookies from "js-cookie"; |
| | | import {getUserById} from "@/api/hazardousChemicals/user"; |
| | | import {getConfigById} from "@/api/hazardousChemicals/config"; |
| | | const useUserStore = defineStore( |
| | | 'user', |
| | | { |
| | |
| | | setToken(res.data.token) |
| | | if(res.data && res.data.id){ |
| | | const info = await getUserById(res.data.id); |
| | | if(info.data.code === 200){} |
| | | Cookies.set('userInfo',JSON.stringify(info.data)) |
| | | if(info.code === 200){ |
| | | Cookies.set('userInfo',JSON.stringify(info.data)) |
| | | } |
| | | if(info.data.userType != 0){ |
| | | const con = await getConfigById(res.data.companyId); |
| | | if(con.code === 200){ |
| | | Cookies.set('configInfo',JSON.stringify(con.data)) |
| | | } |
| | | } |
| | | } |
| | | this.token = res.data.token |
| | | resolve() |