Resolved conflict

This commit is contained in:
Daniel Cojocea committed 2024-07-09 17:01:07 -04:00
commit ff2e08b483
8 files changed
+54 -40

No files matched your search

+5 -6
View File
@@ -1,7 +1,6 @@
import axios from "axios";
import axiosInstance from "../../Utils/axiosConfig";
import { createAsyncThunk, createSlice } from "@reduxjs/toolkit";
import { jwtDecode } from "jwt-decode";
const BASE_URL = import.meta.env.VITE_APP_API_BASE_URL;
const initialState = {
isLoading: false,
@@ -15,7 +14,7 @@ export const register = createAsyncThunk(
"auth/register",
async (form, thunkApi) => {
try {
const res = await axios.post(`${BASE_URL}/auth/register`, form);
const res = await axiosInstance.post("/auth/register", form);
return res.data;
} catch (error) {
if (error.response.data) {
@@ -28,7 +27,7 @@ export const register = createAsyncThunk(
export const login = createAsyncThunk("auth/login", async (form, thunkApi) => {
try {
const res = await axios.post(`${BASE_URL}/auth/login`, form);
const res = await axiosInstance.post(`/auth/login`, form);
return res.data;
} catch (error) {
if (error.response && error.response.data) {
@@ -51,7 +50,7 @@ export const update = createAsyncThunk(
fd.append("firstname", form.firstname);
fd.append("lastname", form.lastname);
if (form.file && form.file !== "") {
const imageResult = await axios.get(form.file, {
const imageResult = await axiosInstance.get(form.file, {
responseType: "blob",
});
fd.append("profileImage", imageResult.data);
@@ -59,7 +58,7 @@ export const update = createAsyncThunk(
form.deleteProfileImage &&
fd.append("deleteProfileImage", form.deleteProfileImage);
const res = await axios.post(`${BASE_URL}/auth/user/${user._id}`, fd, {
const res = await axiosInstance.post(`/auth/user/${user._id}`, fd, {
headers: {
Authorization: `Bearer ${token}`,
"Content-Type": "multipart/form-data",
+8 -15
View File
@@ -1,8 +1,6 @@
import axios from "axios";
import { createAsyncThunk, createSlice } from "@reduxjs/toolkit";
import { jwtDecode } from "jwt-decode";
const BASE_URL = import.meta.env.VITE_APP_API_BASE_URL;
import axiosInstance from "../../Utils/axiosConfig";
const initialState = {
isLoading: false,
monitors: [],
@@ -16,7 +14,7 @@ export const createMonitor = createAsyncThunk(
try {
const { authToken, monitor } = data;
const res = await axios.post(`${BASE_URL}/monitors`, monitor, {
const res = await axiosInstance.post(`/monitors`, monitor, {
headers: {
Authorization: `Bearer ${authToken}`,
"Content-Type": "application/json",
@@ -36,9 +34,7 @@ export const getMonitors = createAsyncThunk(
"monitors/getMonitors",
async (token, thunkApi) => {
try {
const res = await axios.get(
import.meta.env.VITE_APP_API_BASE_URL + "/monitors"
);
const res = await axiosInstance.get("/monitors");
return res.data;
} catch (error) {
if (error.response && error.response.data) {
@@ -54,14 +50,11 @@ export const getMonitorsByUserId = createAsyncThunk(
async (token, thunkApi) => {
const user = jwtDecode(token);
try {
const res = await axios.get(
import.meta.env.VITE_APP_API_BASE_URL + "/monitors/user/" + user._id,
{
headers: {
Authorization: `Bearer ${token}`,
},
}
);
const res = await axiosInstance.get("/monitors/user/" + user._id, {
headers: {
Authorization: `Bearer ${token}`,
},
});
return res.data;
} catch (error) {
if (error.response && error.response.data) {