Fixed save picture functionality

This commit is contained in:
Daniel Cojocea committed 2024-07-05 19:52:29 -04:00
1 parent 3fd819293c
commit 28c3616004
3 files changed
+73 -61

No files matched your search

+7 -1
View File
@@ -47,7 +47,13 @@ export const update = createAsyncThunk(
//1.5s delay to show loading spinner
await new Promise((resolve) => setTimeout(resolve, 1500));
const res = await axios.post(`${BASE_URL}/auth/user/${user._id}`, form, {
const fd = new FormData();
const imageResult = await axios.get(form.file);
fd.append("firstname", form.firstname);
fd.append("lastname", form.lastname);
fd.append("profileImage", imageResult.data);
const res = await axios.post(`${BASE_URL}/auth/user/${user._id}`, fd, {
headers: {
Authorization: `Bearer ${token}`,
"Content-Type": "multipart/form-data",