-
+
@@ -36,7 +38,7 @@ function RowDetail({ employeeData, header, breakpoint, showDetails, handleSort }
-
+
{employeeData}
diff --git a/frontend/src/components/modal/ModalChangePassword.tsx b/frontend/src/components/modal/ModalChangePassword.tsx
index 0485153..3053d17 100644
--- a/frontend/src/components/modal/ModalChangePassword.tsx
+++ b/frontend/src/components/modal/ModalChangePassword.tsx
@@ -5,12 +5,15 @@
import { useEffect, useState } from 'react';
import { FaTimes } from 'react-icons/fa';
import { useDispatch, useSelector } from 'react-redux';
+import Image from 'next/image';
+import Swal from 'sweetalert2';
import Input from '../Input';
import Button from '../buttons/Button';
import { AppDispatch, RootState } from '../../store';
import passwordChange from '../../services/passwordChange';
import { clearError } from '../../store/passwordChangeSlice';
import { closeModalPasswordChange } from '../../store/modalPasswordChangeSlice';
+import forgetPasswordAvatar from '../../../public/forgotPasswordAvatar.svg';
function ModalChangePassword() {
const dispatch = useDispatch();
@@ -50,8 +53,30 @@ function ModalChangePassword() {
const handleSubmit = async (event: React.FormEvent) => {
event.preventDefault();
- dispatch(clearError());
- dispatch(passwordChange(formData.email));
+
+ const resultAction = await dispatch(passwordChange(formData.email));
+
+ if (passwordChange.fulfilled.match(resultAction)) {
+ const Toast = Swal.mixin({
+ toast: true,
+ position: 'top-end',
+ showConfirmButton: false,
+ timer: 3000,
+ timerProgressBar: true,
+ didOpen: (toast) => {
+ toast.onmouseenter = Swal.stopTimer;
+ toast.onmouseleave = Swal.resumeTimer;
+ },
+ });
+
+ Toast.fire({
+ icon: 'success',
+ title: 'Email sent successfully',
+ }).then(() => {
+ dispatch(closeModalPasswordChange());
+ dispatch(clearError());
+ });
+ }
};
const handleClickInside = (event: React.MouseEvent) => {
@@ -87,10 +112,18 @@ function ModalChangePassword() {
className="font-bold text-center text-2xl text-light-neutral-900"
>
- Please enter your email
+ Forgot password?
+
+
|