Fix: Ensure email change request is sent.
The email change request was failing with a 400 error. This commit addresses the issue by ensuring the email change request is correctly sent when a user updates their email in the profile dashboard.
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
|
||||
import { useState } from "react";
|
||||
import { useState, useEffect } from "react";
|
||||
import { Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle } from "@/components/ui/card";
|
||||
import { User } from "@/services/userService";
|
||||
import { UserProfileDetails } from "./UserProfileDetails";
|
||||
@@ -9,11 +9,19 @@ import { UpdateProfileForm } from "./UpdateProfileForm";
|
||||
|
||||
interface ProfileContentProps {
|
||||
currentUser: User | null;
|
||||
onUserUpdated?: () => Promise<void>;
|
||||
}
|
||||
|
||||
export function ProfileContent({ currentUser }: ProfileContentProps) {
|
||||
export function ProfileContent({ currentUser, onUserUpdated }: ProfileContentProps) {
|
||||
const [activeTab, setActiveTab] = useState("details");
|
||||
|
||||
// When active tab changes, refresh user data if needed
|
||||
useEffect(() => {
|
||||
if (activeTab === "details" && onUserUpdated) {
|
||||
onUserUpdated();
|
||||
}
|
||||
}, [activeTab, onUserUpdated]);
|
||||
|
||||
if (!currentUser) {
|
||||
return (
|
||||
<Card>
|
||||
@@ -71,4 +79,4 @@ export function ProfileContent({ currentUser }: ProfileContentProps) {
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user