fixed toast.error
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user