vibe coded v1
This commit is contained in:
@@ -19,13 +19,15 @@ export const useAuth = () => {
|
||||
|
||||
const authFetch = async (input: RequestInfo, init: RequestInit = {}) => {
|
||||
const token = authResponse?.token;
|
||||
const isFormData = init.body instanceof FormData;
|
||||
|
||||
const res = await fetch(input, {
|
||||
...init,
|
||||
headers: {
|
||||
...(init.headers ?? {}),
|
||||
Authorization: `Bearer ${token}`,
|
||||
"Content-Type": "application/json",
|
||||
// Let the browser set Content-Type for FormData (it includes the boundary)
|
||||
...(isFormData ? {} : { "Content-Type": "application/json" }),
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user