|
|
@@ -168,7 +168,7 @@ async function handleAvatarChange(file: UploadFile) {
|
|
|
const formData = new FormData();
|
|
|
formData.append('image', file.raw);
|
|
|
|
|
|
- // 使用 axios 直接上传(需要手动设置 baseURL)
|
|
|
+ // 使用 fetch 直接上传(需要手动设置 baseURL)
|
|
|
const serverStore = (await import('@/stores/server')).useServerStore();
|
|
|
const baseUrl = serverStore.currentServer?.url;
|
|
|
if (!baseUrl) {
|
|
|
@@ -177,12 +177,10 @@ async function handleAvatarChange(file: UploadFile) {
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
- const authStoreLocal = (await import('@/stores/auth')).useAuthStore();
|
|
|
-
|
|
|
fetch(`${baseUrl}/api/upload/avatar`, {
|
|
|
method: 'POST',
|
|
|
headers: {
|
|
|
- Authorization: `Bearer ${authStoreLocal.accessToken}`,
|
|
|
+ Authorization: `Bearer ${authStore.accessToken}`,
|
|
|
},
|
|
|
body: formData,
|
|
|
})
|