debug logs

This commit is contained in:
Zamitto 2024-06-17 22:22:35 -03:00
parent 7fc376b47f
commit c01ed86071

View File

@ -61,6 +61,35 @@ export class HydraApi {
baseURL: import.meta.env.MAIN_VITE_API_URL,
});
this.instance.interceptors.request.use(
(request) => {
console.log(" ---- REQUEST -----");
console.log(request.method, request.baseURL, request.data);
return request;
},
(error) => {
console.log("request error", error);
return Promise.reject(error);
}
);
this.instance.interceptors.response.use(
(response) => {
console.log(" ---- RESPONSE -----");
console.log(
response.status,
response.config.method,
response.config.url,
response.data
);
return response;
},
(error) => {
console.log("response error", error);
return Promise.reject(error);
}
);
const userAuth = await userAuthRepository.findOne({
where: { id: 1 },
});