Fix issue: Broken pasted image upload

This commit is contained in:
Ivan Pantic
2025-12-09 22:12:45 +01:00
parent 1f4cd16b89
commit 19bb741af0
2 changed files with 9 additions and 6 deletions

View File

@@ -3,9 +3,12 @@ export const authenticatedFetch = (url, options = {}) => {
const isPlatform = import.meta.env.VITE_IS_PLATFORM === 'true'; const isPlatform = import.meta.env.VITE_IS_PLATFORM === 'true';
const token = localStorage.getItem('auth-token'); const token = localStorage.getItem('auth-token');
const defaultHeaders = { const defaultHeaders = {};
'Content-Type': 'application/json',
}; // Only set Content-Type if body is not FormData (browser will set it automatically for FormData)
if (!(options.body instanceof FormData)) {
defaultHeaders['Content-Type'] = 'application/json';
}
if (!isPlatform && token) { if (!isPlatform && token) {
defaultHeaders['Authorization'] = `Bearer ${token}`; defaultHeaders['Authorization'] = `Bearer ${token}`;