mirror of
https://github.com/pacnpal/thrilltrack-explorer.git
synced 2025-12-20 06:11:11 -05:00
Fix account deletion flow
This commit is contained in:
@@ -84,7 +84,7 @@ export function AccountProfileTab() {
|
||||
isValid: usernameValidation.isAvailable !== false
|
||||
});
|
||||
|
||||
// Check for existing deletion request on mount
|
||||
// Check for existing deletion request on mount (both pending and confirmed)
|
||||
useEffect(() => {
|
||||
const checkDeletionRequest = async () => {
|
||||
if (!user?.id) return;
|
||||
@@ -93,7 +93,7 @@ export function AccountProfileTab() {
|
||||
.from('account_deletion_requests')
|
||||
.select('*')
|
||||
.eq('user_id', user.id)
|
||||
.eq('status', 'pending')
|
||||
.in('status', ['pending', 'confirmed'])
|
||||
.maybeSingle();
|
||||
|
||||
if (!error && data) {
|
||||
@@ -210,12 +210,12 @@ export function AccountProfileTab() {
|
||||
};
|
||||
|
||||
const handleDeletionRequested = async () => {
|
||||
// Refresh deletion request data
|
||||
// Refresh deletion request data (check for both pending and confirmed)
|
||||
const { data, error } = await supabase
|
||||
.from('account_deletion_requests')
|
||||
.select('*')
|
||||
.eq('user_id', user!.id)
|
||||
.eq('status', 'pending')
|
||||
.in('status', ['pending', 'confirmed'])
|
||||
.maybeSingle();
|
||||
|
||||
if (!error && data) {
|
||||
@@ -235,6 +235,7 @@ export function AccountProfileTab() {
|
||||
{deletionRequest && (
|
||||
<DeletionStatusBanner
|
||||
scheduledDate={deletionRequest.scheduled_deletion_at}
|
||||
status={deletionRequest.status as 'pending' | 'confirmed'}
|
||||
onCancelled={handleDeletionCancelled}
|
||||
/>
|
||||
)}
|
||||
|
||||
Reference in New Issue
Block a user