Fix uploads
This commit is contained in:
@@ -24,9 +24,17 @@ export function useClient() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Add authorization header if authenticated
|
||||||
if (authStore.isAuthenticated) {
|
if (authStore.isAuthenticated) {
|
||||||
config.headers.Authorization = `Bearer ${authStore.accessToken}`;
|
config.headers.Authorization = `Bearer ${authStore.accessToken}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Don't override Content-Type for FormData requests
|
||||||
|
if (config.data instanceof FormData) {
|
||||||
|
// Let the browser set the correct Content-Type with boundary
|
||||||
|
delete config.headers['Content-Type'];
|
||||||
|
}
|
||||||
|
|
||||||
return config;
|
return config;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user