delete all toast and modified botton add equipo
This commit is contained in:
@@ -13,22 +13,26 @@ export default function ChangePassword() {
|
||||
e.preventDefault();
|
||||
const data = { password, newPassword };
|
||||
|
||||
try{
|
||||
try {
|
||||
const response = await apiClient.post("/user/changePassword", data);
|
||||
toast.success( `${response.data.message}`)
|
||||
Swal.fire({
|
||||
title: response.data.message,
|
||||
icon: "success",
|
||||
draggable: true,
|
||||
});
|
||||
setPass('');
|
||||
setNewPass('');
|
||||
setconfirmNewPass('');
|
||||
}catch{
|
||||
|
||||
Swal.fire({
|
||||
title: "No es la contraseña actual!",
|
||||
icon: "error",
|
||||
draggable: true,
|
||||
});
|
||||
|
||||
} catch {
|
||||
|
||||
Swal.fire({
|
||||
title: "No es tu contraseña actual!",
|
||||
icon: "error",
|
||||
draggable: true,
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
};
|
||||
|
||||
return (
|
||||
|
||||
@@ -17,29 +17,33 @@ function Login() {
|
||||
e.preventDefault();
|
||||
|
||||
if (!user) {
|
||||
|
||||
Swal.fire({
|
||||
title: "Coloca un usuario!",
|
||||
icon: "error",
|
||||
draggable: true,
|
||||
});
|
||||
|
||||
Swal.fire({
|
||||
title: "Coloca un usuario!",
|
||||
icon: "error",
|
||||
draggable: true,
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
if (!password) {
|
||||
|
||||
|
||||
Swal.fire({
|
||||
title: "Coloca una contraseña!",
|
||||
icon: "error",
|
||||
draggable: true,
|
||||
});
|
||||
title: "Coloca una contraseña!",
|
||||
icon: "error",
|
||||
draggable: true,
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
const data = await loginUser(user, password);
|
||||
|
||||
if ("error" in data) {
|
||||
toast.error(data.error);
|
||||
Swal.fire({
|
||||
title: data.error,
|
||||
icon: "error",
|
||||
draggable: true,
|
||||
});
|
||||
} else {
|
||||
const token = data.access_token;
|
||||
const payload = JSON.parse(atob(token.split(".")[1]));
|
||||
@@ -50,12 +54,12 @@ function Login() {
|
||||
document.cookie = `user=${usuario}; path=/; SameSite=Strict`;
|
||||
document.cookie = `role=${role}; path=/; SameSite=Strict`;
|
||||
|
||||
|
||||
|
||||
Swal.fire({
|
||||
title: "Inicio de sesión exitoso!",
|
||||
icon: "success",
|
||||
draggable: true,
|
||||
});
|
||||
title: "Inicio de sesión exitoso!",
|
||||
icon: "success",
|
||||
draggable: true,
|
||||
});
|
||||
router.push("/Impresiones");
|
||||
router.refresh();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user