Added configured axios instance with 401 interceptor, refactored all requests to use axios instance

This commit is contained in:
Alex Holliday committed 2024-07-09 11:45:14 -07:00
1 parent fb292d23a6
commit 10c8751c6b
8 files changed
+56 -40

No files matched your search

+3 -6
View File
@@ -11,12 +11,9 @@ import Check from "../../Components/Check/Check";
import Button from "../../Components/Button";
import Google from "../../assets/Images/Google.png";
import { registerValidation } from "../../Validation/validation";
import axiosInstance from "../../Utils/axiosConfig";
import { useDispatch } from "react-redux";
import { register } from "../../Features/Auth/authSlice";
import axios from "axios";
const BASE_URL = import.meta.env.VITE_APP_API_BASE_URL;
const Register = () => {
const dispatch = useDispatch();
@@ -41,8 +38,8 @@ const Register = () => {
});
useEffect(() => {
axios
.get(BASE_URL + "/auth/users/admin")
axiosInstance
.get("/auth/users/admin")
.then((response) => {
if (response.data.data === true) {
navigate("/login");