fix: 🐛 移除个人中心传递用户id的问题

This commit is contained in:
ray
2024-08-20 00:35:41 +08:00
parent 5883cae2b1
commit e226b34707
2 changed files with 4 additions and 7 deletions

View File

@@ -138,9 +138,9 @@ class UserAPI {
}
/** 获取个人中心用户信息 */
static getProfile(id: number) {
static getProfile() {
return request<any, UserProfileVO>({
url: `${USER_BASE_URL}/${id}/profile`,
url: `${USER_BASE_URL}/profile`,
method: "get",
});
}

View File

@@ -304,11 +304,8 @@ import UserAPI, {
import FileAPI from "@/api/file";
import { useUserStore } from "@/store/modules/user";
import { Camera } from "@element-plus/icons-vue";
const userStore = useUserStore();
const userProfile = ref<UserProfileVO>({});
enum DialogType {
@@ -496,7 +493,7 @@ const handleFileChange = async (event: Event) => {
// 更新用户头像
userProfile.value.avatar = data.url;
// 更新用户信息
await UserAPI.updateProfile(userProfile.value.id as number, {
await UserAPI.updateProfile({
avatar: data.url,
});
} catch (error) {
@@ -507,7 +504,7 @@ const handleFileChange = async (event: Event) => {
/** 加载用户信息 */
const loadUserProfile = async () => {
const data = await UserAPI.getProfile(userStore.user.userId);
const data = await UserAPI.getProfile();
userProfile.value = data;
};