Use axios directly for fetching file

This commit is contained in:
Alex Holliday committed 2024-08-29 12:58:32 -07:00
1 parent 9b177426c2
commit 43dff00cd6
3 files changed
+2 -4

No files matched your search

+2 -2
View File
@@ -1,6 +1,7 @@
import { networkService } from "../../main";
import { createAsyncThunk, createSlice } from "@reduxjs/toolkit";
import { jwtDecode } from "jwt-decode";
import axios from "axios";
const initialState = {
isLoading: false,
@@ -57,9 +58,8 @@ export const update = createAsyncThunk(
form.password && fd.append("password", form.password);
form.newPassword && fd.append("newPassword", form.newPassword);
if (form.file && form.file !== "") {
const imageResult = await networkService.get(form.file, {
const imageResult = await axios.get(form.file, {
responseType: "blob",
baseURL: "",
});
fd.append("profileImage", imageResult.data);
}
-1
View File
@@ -226,7 +226,6 @@ class NetworkService {
return this.axiosInstance.put(`/auth/user/${userId}`, form, {
headers: {
Authorization: `Bearer ${authToken}`,
"Content-Type": "application/json",
},
});
}
-1
View File
@@ -89,7 +89,6 @@ const getUserByEmail = async (email) => {
const updateUser = async (req, res) => {
const candidateUserId = req.params.userId;
try {
const candidateUser = { ...req.body };
// ******************************************