Added toast alerts to password panel
This commit is contained in:
1 parent
e9bab07309
commit
8bd8c292b8
2 files changed
+12
-3
No files matched your search
@@ -8,6 +8,7 @@ import { editPasswordValidation } from "../../../Validation/validation";
|
|||||||
import Alert from "../../Alert";
|
import Alert from "../../Alert";
|
||||||
import { update } from "../../../Features/Auth/authSlice";
|
import { update } from "../../../Features/Auth/authSlice";
|
||||||
import { useDispatch, useSelector } from "react-redux";
|
import { useDispatch, useSelector } from "react-redux";
|
||||||
|
import { createToast } from "../../../Utils/toastUtils";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* PasswordPanel component manages the form for editing password.
|
* PasswordPanel component manages the form for editing password.
|
||||||
@@ -78,15 +79,23 @@ const PasswordPanel = () => {
|
|||||||
} else {
|
} else {
|
||||||
const action = await dispatch(update({ authToken, localData }));
|
const action = await dispatch(update({ authToken, localData }));
|
||||||
if (action.payload.success) {
|
if (action.payload.success) {
|
||||||
// TODO: Add toast/notification for password update success
|
createToast({
|
||||||
|
variant: "info",
|
||||||
|
body: "Your password was changed successfully.",
|
||||||
|
hasIcon: false,
|
||||||
|
});
|
||||||
setLocalData({
|
setLocalData({
|
||||||
password: "",
|
password: "",
|
||||||
newPassword: "",
|
newPassword: "",
|
||||||
confirm: "",
|
confirm: "",
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
// TODO: Add toast/notification for password update rejected
|
|
||||||
// TODO: Check for other errors?
|
// TODO: Check for other errors?
|
||||||
|
createToast({
|
||||||
|
variant: "info",
|
||||||
|
body: "Your password input was incorrect.",
|
||||||
|
hasIcon: false,
|
||||||
|
});
|
||||||
setErrors({ password: "*" + action.payload.msg + "." });
|
setErrors({ password: "*" + action.payload.msg + "." });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -86,7 +86,7 @@ const ProfilePanel = () => {
|
|||||||
delete: false,
|
delete: false,
|
||||||
});
|
});
|
||||||
|
|
||||||
//TODO - potentitally remove once image compression functions are implemented
|
//TODO - potentitally remove, will revisit in the future
|
||||||
intervalRef.current = setInterval(() => {
|
intervalRef.current = setInterval(() => {
|
||||||
const buffer = 12;
|
const buffer = 12;
|
||||||
setProgress((prev) => {
|
setProgress((prev) => {
|
||||||
|
|||||||
Reference in new issue
Block a user