From 685a758f53686c80b794d4fd85b9e6c56c4b631c Mon Sep 17 00:00:00 2001 From: Jonathan Bourdon Date: Thu, 17 Apr 2025 05:01:50 -0400 Subject: [PATCH] Fix uploads --- frontend/src/plugins/api.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/frontend/src/plugins/api.js b/frontend/src/plugins/api.js index d823b7f..76a5bdd 100644 --- a/frontend/src/plugins/api.js +++ b/frontend/src/plugins/api.js @@ -24,9 +24,17 @@ export function useClient() { } } + // Add authorization header if authenticated if (authStore.isAuthenticated) { 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; });