This commit is contained in:
natib21
2026-07-17 13:10:27 +00:00
parent 6f126a2345
commit 0d98ccb04b
8 changed files with 151 additions and 82 deletions

View File

@@ -213,12 +213,15 @@ const UserManagementTree = () => {
// Handle inviting or resending invitation to employees
const handleInviteEmployee = async (employee: TeamMemberDto) => {
try {
// Show immediate feedback that action is being processed
if (employee.status === "pending") {
toast.loading("Resending verification code...");
} else {
toast.loading("Sending invitation...");
}
// A member who already set a password is being sent a fresh set-password
// code — that is a reset, not an invite, so say so. Keyed off
// hasSetPassword (the same fact the menu label uses) rather than the
// looser `status` field, so the wording cannot disagree with the menu.
const isReset = employee.user.hasSetPassword;
toast.loading(
isReset ? "Sending password reset link..." : "Resending verification code...",
);
await resendVerificationCode({
email: employee.user.email,
phoneNumber: employee.user.phoneNumber,
@@ -229,14 +232,14 @@ const UserManagementTree = () => {
? localizedName(employee.user.name)
: localizedName(employee.user.name) || "User";
if (employee.user.status === "pending") {
toast.success("Verification Code Resent", {
description: `A new verification code has been sent to ${userName}`,
if (isReset) {
toast.success("Password Reset Link Sent", {
description: `${userName} can now set a new password. Any earlier code they had no longer works.`,
duration: 4000,
});
} else {
toast.success("Invitation Sent", {
description: `Invitation sent to ${userName}`,
toast.success("Verification Code Resent", {
description: `A new verification code has been sent to ${userName}`,
duration: 4000,
});
}