mirror of
https://github.com/bluewave-labs/Checkmate.git
synced 2026-04-26 02:48:54 -05:00
Merge pull request #752 from bluewave-labs/fix/profile-update
Use axios directly for fetching file, resolves #751
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
@@ -226,7 +226,6 @@ class NetworkService {
|
||||
return this.axiosInstance.put(`/auth/user/${userId}`, form, {
|
||||
headers: {
|
||||
Authorization: `Bearer ${authToken}`,
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
@@ -89,7 +89,6 @@ const getUserByEmail = async (email) => {
|
||||
|
||||
const updateUser = async (req, res) => {
|
||||
const candidateUserId = req.params.userId;
|
||||
|
||||
try {
|
||||
const candidateUser = { ...req.body };
|
||||
// ******************************************
|
||||
|
||||
Reference in New Issue
Block a user