wip
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
'use client';
|
||||
|
||||
import { useState, useEffect } from 'react';
|
||||
import { useState, useEffect, useCallback } from 'react';
|
||||
import { useRouter } from 'next/navigation';
|
||||
import Button from '../ui/Button';
|
||||
import Card from '../ui/Card';
|
||||
@@ -15,7 +15,7 @@ import {
|
||||
getCurrentDriverId,
|
||||
type JoinRequest,
|
||||
type MembershipRole,
|
||||
} from '@gridpilot/racing/application';
|
||||
} from '@/lib/racingLegacyFacade';
|
||||
import { getDriverRepository } from '@/lib/di-container';
|
||||
import { Driver } from '@gridpilot/racing/domain/entities/Driver';
|
||||
|
||||
@@ -33,11 +33,7 @@ export default function LeagueAdmin({ league, onLeagueUpdate }: LeagueAdminProps
|
||||
const [error, setError] = useState<string | null>(null);
|
||||
const [activeTab, setActiveTab] = useState<'members' | 'requests' | 'races' | 'settings'>('members');
|
||||
|
||||
useEffect(() => {
|
||||
loadJoinRequests();
|
||||
}, [league.id]);
|
||||
|
||||
const loadJoinRequests = async () => {
|
||||
const loadJoinRequests = useCallback(async () => {
|
||||
setLoading(true);
|
||||
try {
|
||||
const requests = getJoinRequests(league.id);
|
||||
@@ -53,7 +49,11 @@ export default function LeagueAdmin({ league, onLeagueUpdate }: LeagueAdminProps
|
||||
} finally {
|
||||
setLoading(false);
|
||||
}
|
||||
};
|
||||
}, [league.id]);
|
||||
|
||||
useEffect(() => {
|
||||
loadJoinRequests();
|
||||
}, [loadJoinRequests]);
|
||||
|
||||
const handleApproveRequest = (requestId: string) => {
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user