Ajusta compose
This commit is contained in:
@@ -2,10 +2,7 @@ import axios from "axios";
|
||||
import Cookies from "js-cookie";
|
||||
|
||||
export const API = axios.create({
|
||||
baseURL: "http://localhost:3000",
|
||||
// process.env.NODE_ENV === "development"
|
||||
// ? "https://api.clipperia.com.br"
|
||||
// : "http://nestjs:3000",
|
||||
baseURL: import.meta.env.VITE_API_URL || "http://localhost:3000",
|
||||
});
|
||||
|
||||
API.interceptors.request.use((config) => {
|
||||
@@ -21,7 +18,7 @@ API.interceptors.request.use((config) => {
|
||||
API.interceptors.response.use(
|
||||
(response) => response,
|
||||
(error) => {
|
||||
if (error.response.status === 401) {
|
||||
if (error.response?.status === 401) {
|
||||
Cookies.remove("token");
|
||||
window.location.href = "/login";
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user