feat(profile): add resend verification email button
This commit is contained in:
@@ -72,6 +72,7 @@ export default function ProfilePage() {
|
|||||||
const [isEditing, setIsEditing] = useState(false);
|
const [isEditing, setIsEditing] = useState(false);
|
||||||
const [isSaving, setIsSaving] = useState(false);
|
const [isSaving, setIsSaving] = useState(false);
|
||||||
const [pendingInvites, setPendingInvites] = useState<PendingInvite[]>([]);
|
const [pendingInvites, setPendingInvites] = useState<PendingInvite[]>([]);
|
||||||
|
const [isResending, setIsResending] = useState(false);
|
||||||
|
|
||||||
// Delete account dialog state
|
// Delete account dialog state
|
||||||
const [deleteDialogOpen, setDeleteDialogOpen] = useState(false);
|
const [deleteDialogOpen, setDeleteDialogOpen] = useState(false);
|
||||||
@@ -178,6 +179,25 @@ export default function ProfilePage() {
|
|||||||
setIsEditing(false);
|
setIsEditing(false);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const handleResendVerification = async () => {
|
||||||
|
setIsResending(true);
|
||||||
|
try {
|
||||||
|
await api.auth.resendVerification(user.email);
|
||||||
|
toast({
|
||||||
|
title: "Verification email sent",
|
||||||
|
description: "Check your inbox.",
|
||||||
|
});
|
||||||
|
} catch (err) {
|
||||||
|
toast({
|
||||||
|
variant: "destructive",
|
||||||
|
title: "Failed to send",
|
||||||
|
description: err instanceof ApiError ? err.message : "An error occurred.",
|
||||||
|
});
|
||||||
|
} finally {
|
||||||
|
setIsResending(false);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
if (authLoading || !user) {
|
if (authLoading || !user) {
|
||||||
return <ProfileSkeleton />;
|
return <ProfileSkeleton />;
|
||||||
}
|
}
|
||||||
@@ -315,6 +335,18 @@ export default function ProfilePage() {
|
|||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
{!user.email_verified && (
|
||||||
|
<Button
|
||||||
|
variant="outline"
|
||||||
|
size="sm"
|
||||||
|
className="mt-3"
|
||||||
|
onClick={handleResendVerification}
|
||||||
|
disabled={isResending}
|
||||||
|
>
|
||||||
|
{isResending && <Loader2 className="w-4 h-4 mr-2 animate-spin" />}
|
||||||
|
Send verification email
|
||||||
|
</Button>
|
||||||
|
)}
|
||||||
</CardContent>
|
</CardContent>
|
||||||
</Card>
|
</Card>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user