fixed toast.error

This commit is contained in:
2026-01-28 17:04:29 -06:00
parent 8c9e0e5de6
commit ee4270f083
2 changed files with 12 additions and 7 deletions
+5 -5
View File
@@ -51,11 +51,11 @@ function Impressions({ costs, numAcount, id_servicio }: ImpressionsProps) {
id_servicio,
});
if (result.error) {
if (result.error === "Token inválido") handleLogout();
else {
toast.error(result.error);
return;
if (result?.error) {
if (result.message === "Token inválido") {
handleLogout();
} else {
toast.error(result.message);
}
return;
}
+7 -2
View File
@@ -6,10 +6,15 @@ export async function PostImpressions(data: any) {
return response.data;
} catch (error: any) {
const msg =
error.response?.data?.error ||
error.response?.data?.message ||
error.message ||
"Error desconocido al cobrar impresión";
return { error: msg };
return {
error: true,
message: msg,
statusCode: error.response?.status,
};
}
}
//IO