fix: 🐛 移除个人中心传递用户id的问题
This commit is contained in:
@@ -138,9 +138,9 @@ class UserAPI {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** 获取个人中心用户信息 */
|
/** 获取个人中心用户信息 */
|
||||||
static getProfile(id: number) {
|
static getProfile() {
|
||||||
return request<any, UserProfileVO>({
|
return request<any, UserProfileVO>({
|
||||||
url: `${USER_BASE_URL}/${id}/profile`,
|
url: `${USER_BASE_URL}/profile`,
|
||||||
method: "get",
|
method: "get",
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -304,11 +304,8 @@ import UserAPI, {
|
|||||||
|
|
||||||
import FileAPI from "@/api/file";
|
import FileAPI from "@/api/file";
|
||||||
|
|
||||||
import { useUserStore } from "@/store/modules/user";
|
|
||||||
import { Camera } from "@element-plus/icons-vue";
|
import { Camera } from "@element-plus/icons-vue";
|
||||||
|
|
||||||
const userStore = useUserStore();
|
|
||||||
|
|
||||||
const userProfile = ref<UserProfileVO>({});
|
const userProfile = ref<UserProfileVO>({});
|
||||||
|
|
||||||
enum DialogType {
|
enum DialogType {
|
||||||
@@ -496,7 +493,7 @@ const handleFileChange = async (event: Event) => {
|
|||||||
// 更新用户头像
|
// 更新用户头像
|
||||||
userProfile.value.avatar = data.url;
|
userProfile.value.avatar = data.url;
|
||||||
// 更新用户信息
|
// 更新用户信息
|
||||||
await UserAPI.updateProfile(userProfile.value.id as number, {
|
await UserAPI.updateProfile({
|
||||||
avatar: data.url,
|
avatar: data.url,
|
||||||
});
|
});
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
@@ -507,7 +504,7 @@ const handleFileChange = async (event: Event) => {
|
|||||||
|
|
||||||
/** 加载用户信息 */
|
/** 加载用户信息 */
|
||||||
const loadUserProfile = async () => {
|
const loadUserProfile = async () => {
|
||||||
const data = await UserAPI.getProfile(userStore.user.userId);
|
const data = await UserAPI.getProfile();
|
||||||
userProfile.value = data;
|
userProfile.value = data;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user