updating font

This commit is contained in:
2024-09-09 20:43:16 -06:00
parent 945253c208
commit 099eaedfd7
10 changed files with 110 additions and 19 deletions

View File

@@ -0,0 +1,27 @@
import axios, { AxiosInstance, AxiosError } from "axios";
import toast from "react-hot-toast";
export const axiosClient: AxiosInstance = axios.create();
axiosClient.interceptors.response.use(
(response) => response,
(error: AxiosError) => {
if (error.response) {
console.log("response error", error.response);
const responseErrorText =
typeof error.response.data === "object"
? (error.response.data as any).error
: error.response.data;
toast.error(
`Error: ${error.response.status} - ${responseErrorText}, ${decodeURI(
error.response.config.url ?? ""
)}`
);
} else if (error.request) {
toast.error("Error: No response from server");
} else {
toast.error(`Error: ${error.message}`);
}
return Promise.reject(error);
}
);