add website tests
This commit is contained in:
@@ -22,7 +22,9 @@ interface EntitySection {
|
||||
|
||||
export default function SponsorshipRequestsPage() {
|
||||
const currentDriverId = useEffectiveDriverId();
|
||||
|
||||
|
||||
const { sponsorshipService, driverService, leagueService, teamService, leagueMembershipService } = useServices();
|
||||
|
||||
const [sections, setSections] = useState<EntitySection[]>([]);
|
||||
const [loading, setLoading] = useState(true);
|
||||
const [error, setError] = useState<string | null>(null);
|
||||
@@ -32,7 +34,10 @@ export default function SponsorshipRequestsPage() {
|
||||
setError(null);
|
||||
|
||||
try {
|
||||
const { sponsorshipService, driverService, leagueService, teamService, leagueMembershipService } = useServices();
|
||||
if (!currentDriverId) {
|
||||
setSections([]);
|
||||
return;
|
||||
}
|
||||
|
||||
const allSections: EntitySection[] = [];
|
||||
|
||||
@@ -107,20 +112,20 @@ export default function SponsorshipRequestsPage() {
|
||||
} finally {
|
||||
setLoading(false);
|
||||
}
|
||||
}, [currentDriverId]);
|
||||
}, [currentDriverId, sponsorshipService, driverService, leagueService, teamService, leagueMembershipService]);
|
||||
|
||||
useEffect(() => {
|
||||
loadAllRequests();
|
||||
}, [loadAllRequests]);
|
||||
|
||||
const handleAccept = async (requestId: string) => {
|
||||
const { sponsorshipService } = useServices();
|
||||
if (!currentDriverId) return;
|
||||
await sponsorshipService.acceptSponsorshipRequest(requestId, currentDriverId);
|
||||
await loadAllRequests();
|
||||
};
|
||||
|
||||
const handleReject = async (requestId: string, reason?: string) => {
|
||||
const { sponsorshipService } = useServices();
|
||||
if (!currentDriverId) return;
|
||||
await sponsorshipService.rejectSponsorshipRequest(requestId, currentDriverId, reason);
|
||||
await loadAllRequests();
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user