Loading web/src/core/utils/Messages.ts +6 −9 Original line number Diff line number Diff line Loading @@ -11,14 +11,11 @@ export const showErrorAxios = (error: AxiosError) => { // Determine the error message based on the error code switch (error.code) { case(axios.AxiosError.ERR_BAD_REQUEST): message = "Acceso no autorizado"; // Unauthorized access break; case(axios.AxiosError.ERR_NETWORK): case axios.AxiosError.ERR_NETWORK: message = "Conexión con el servidor fallida"; // Server connection failed break; default: message = error.message; // Default to the error message provided by Axios message = (error.response?.data as any).message || "Error de servidor"; // Default to the error message provided by Axios break; } Loading @@ -31,6 +28,6 @@ export const showErrorAxios = (error: AxiosError) => { pauseOnHover: false, // Do not pause the toast on hover draggable: true, // Allow the toast to be draggable progress: undefined, // Use the default progress bar behavior theme: "colored" // Use the colored theme for the toast theme: "colored", // Use the colored theme for the toast }); } No newline at end of file }; web/src/domain/useCase/useCategory.ts +3 −3 Original line number Diff line number Diff line Loading @@ -95,12 +95,12 @@ export const useCategory = ( if (axios.isAxiosError(error)) { error as AxiosError; switch (error.code) { case axios.AxiosError.ERR_BAD_REQUEST: errorMessage = "Acceso no autorizado"; break; case axios.AxiosError.ERR_NETWORK: errorMessage = "Conexión con el servidor fallida"; break; default: errorMessage = error.response?.data.message; break; } } throw new Error(errorMessage); Loading web/src/domain/useCase/useLogin.ts +6 −6 Original line number Diff line number Diff line Loading @@ -72,16 +72,16 @@ export const useLogin = (setIsLoading: Dispatch<SetStateAction<boolean>>) => { if (axios.isAxiosError(error)) { error as AxiosError; switch (error.code) { case axios.AxiosError.ERR_BAD_REQUEST: case axios.AxiosError.ERR_NETWORK: setError("root.serverError", { type: "401", message: "Correo electrónico o contraseña incorrectos", type: "500", message: "Conexión con el servidor fallida", }); break; case axios.AxiosError.ERR_NETWORK: default: setError("root.serverError", { type: "500", message: "Conexión con el servidor fallida", message: error.response?.data.message || "Error de servidor", }); break; } Loading web/src/domain/useCase/useResetPassword.ts +4 −3 Original line number Diff line number Diff line Loading @@ -122,12 +122,13 @@ export const useResetPassword = (handleClickToClose?: () => void) => { if (axios.isAxiosError(error)) { error as AxiosError; switch (error.code) { case axios.AxiosError.ERR_BAD_REQUEST: errorMessage = "Acceso no autorizado"; break; case axios.AxiosError.ERR_NETWORK: errorMessage = "Conexión con el servidor fallida"; break; default: errorMessage = error.response?.data.message || "Error de servidor"; break; } } throw new Error(errorMessage); Loading web/src/domain/useCase/useTown.ts +4 −3 Original line number Diff line number Diff line Loading @@ -158,12 +158,13 @@ export const useTown = ( if (axios.isAxiosError(error)) { error as AxiosError; switch (error.code) { case axios.AxiosError.ERR_BAD_REQUEST: errorMessage = "Acceso no autorizado"; break; case axios.AxiosError.ERR_NETWORK: errorMessage = "Conexión con el servidor fallida"; break; default: errorMessage = error.response?.data.message || "Error de servidor"; break; } } throw new Error(errorMessage); Loading Loading
web/src/core/utils/Messages.ts +6 −9 Original line number Diff line number Diff line Loading @@ -11,14 +11,11 @@ export const showErrorAxios = (error: AxiosError) => { // Determine the error message based on the error code switch (error.code) { case(axios.AxiosError.ERR_BAD_REQUEST): message = "Acceso no autorizado"; // Unauthorized access break; case(axios.AxiosError.ERR_NETWORK): case axios.AxiosError.ERR_NETWORK: message = "Conexión con el servidor fallida"; // Server connection failed break; default: message = error.message; // Default to the error message provided by Axios message = (error.response?.data as any).message || "Error de servidor"; // Default to the error message provided by Axios break; } Loading @@ -31,6 +28,6 @@ export const showErrorAxios = (error: AxiosError) => { pauseOnHover: false, // Do not pause the toast on hover draggable: true, // Allow the toast to be draggable progress: undefined, // Use the default progress bar behavior theme: "colored" // Use the colored theme for the toast theme: "colored", // Use the colored theme for the toast }); } No newline at end of file };
web/src/domain/useCase/useCategory.ts +3 −3 Original line number Diff line number Diff line Loading @@ -95,12 +95,12 @@ export const useCategory = ( if (axios.isAxiosError(error)) { error as AxiosError; switch (error.code) { case axios.AxiosError.ERR_BAD_REQUEST: errorMessage = "Acceso no autorizado"; break; case axios.AxiosError.ERR_NETWORK: errorMessage = "Conexión con el servidor fallida"; break; default: errorMessage = error.response?.data.message; break; } } throw new Error(errorMessage); Loading
web/src/domain/useCase/useLogin.ts +6 −6 Original line number Diff line number Diff line Loading @@ -72,16 +72,16 @@ export const useLogin = (setIsLoading: Dispatch<SetStateAction<boolean>>) => { if (axios.isAxiosError(error)) { error as AxiosError; switch (error.code) { case axios.AxiosError.ERR_BAD_REQUEST: case axios.AxiosError.ERR_NETWORK: setError("root.serverError", { type: "401", message: "Correo electrónico o contraseña incorrectos", type: "500", message: "Conexión con el servidor fallida", }); break; case axios.AxiosError.ERR_NETWORK: default: setError("root.serverError", { type: "500", message: "Conexión con el servidor fallida", message: error.response?.data.message || "Error de servidor", }); break; } Loading
web/src/domain/useCase/useResetPassword.ts +4 −3 Original line number Diff line number Diff line Loading @@ -122,12 +122,13 @@ export const useResetPassword = (handleClickToClose?: () => void) => { if (axios.isAxiosError(error)) { error as AxiosError; switch (error.code) { case axios.AxiosError.ERR_BAD_REQUEST: errorMessage = "Acceso no autorizado"; break; case axios.AxiosError.ERR_NETWORK: errorMessage = "Conexión con el servidor fallida"; break; default: errorMessage = error.response?.data.message || "Error de servidor"; break; } } throw new Error(errorMessage); Loading
web/src/domain/useCase/useTown.ts +4 −3 Original line number Diff line number Diff line Loading @@ -158,12 +158,13 @@ export const useTown = ( if (axios.isAxiosError(error)) { error as AxiosError; switch (error.code) { case axios.AxiosError.ERR_BAD_REQUEST: errorMessage = "Acceso no autorizado"; break; case axios.AxiosError.ERR_NETWORK: errorMessage = "Conexión con el servidor fallida"; break; default: errorMessage = error.response?.data.message || "Error de servidor"; break; } } throw new Error(errorMessage); Loading