mirror of
https://github.com/christianvidalwolf-prog/Craze-Data-check.git
synced 2026-08-03 14:05:25 +02:00
fix(auth): resolve concurrent session token refresh and state syncing issues to prevent frequent logouts
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import React, { useState, useEffect } from 'react';
|
||||
import { Users, Search, CheckCircle, XCircle, Trash2, Shield, Loader2, AlertCircle, Clock } from 'lucide-react';
|
||||
import { AuthSession } from '../lib/auth';
|
||||
import { safeFetch } from '../lib/supabase';
|
||||
|
||||
interface User {
|
||||
id: string;
|
||||
@@ -27,11 +28,10 @@ export function UserManagementView({ session }: UserManagementViewProps) {
|
||||
setError(null);
|
||||
setWarning(null);
|
||||
try {
|
||||
const res = await fetch('/api/users-admin', {
|
||||
const res = await safeFetch('/api/users-admin', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
'Authorization': `Bearer ${session.access_token}`
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
body: JSON.stringify({ action: 'list' })
|
||||
});
|
||||
@@ -61,11 +61,10 @@ export function UserManagementView({ session }: UserManagementViewProps) {
|
||||
setError(null);
|
||||
setWarning(null);
|
||||
try {
|
||||
const res = await fetch('/api/users-admin', {
|
||||
const res = await safeFetch('/api/users-admin', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
'Authorization': `Bearer ${session.access_token}`
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
body: JSON.stringify({
|
||||
action: 'validate',
|
||||
@@ -104,11 +103,10 @@ export function UserManagementView({ session }: UserManagementViewProps) {
|
||||
setError(null);
|
||||
setDeleteConfirmUser(null);
|
||||
try {
|
||||
const res = await fetch('/api/users-admin', {
|
||||
const res = await safeFetch('/api/users-admin', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
'Authorization': `Bearer ${session.access_token}`
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
body: JSON.stringify({
|
||||
action: 'delete',
|
||||
|
||||
Reference in New Issue
Block a user