refactor(biji-qianduan): 重构网络请求处理逻辑- 优化了多个组件中的 API 调用,使用 async/await 替代 Promise 链

- 改进了错误处理,统一使用 ElMessage 显示错误信息
- 简化了部分代码结构,提高了可读性和可维护性
This commit is contained in:
ikmkj
2025-08-01 19:47:30 +08:00
parent 9af5154973
commit ef22c0e4b6
3 changed files with 24 additions and 25 deletions

View File

@@ -11,10 +11,10 @@ export const useUserStore = defineStore('user', {
async login(username, password) {
try {
const response = await loginApi({ username, password });
if (response.data && response.data.token) {
this.token = response.data.token;
if (response && response.token) {
this.token = response.token;
// 你可能还需要一个接口来获取用户信息
// this.userInfo = await getUserInfo();
// this.userInfo = await getUserInfo();
return true;
}
return false;