Skip to content

Commit 58864fe

Browse files
hh
1 parent 8334ac4 commit 58864fe

4 files changed

Lines changed: 603 additions & 180 deletions

File tree

hooks/useSportsData.ts

Lines changed: 0 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import useSWR from 'swr';
2-
import { useEffect } from 'react';
32
import type { SportsData } from '@/types/Card';
43

54
const buildApiBasePath = () => {
@@ -45,38 +44,6 @@ export const useSportsData = (cardSet: string | null) => {
4544
}
4645
);
4746

48-
useEffect( () => {
49-
let isActive = true;
50-
51-
const refreshFromServer = async () => {
52-
if ( !cardSet ) {
53-
return;
54-
}
55-
56-
try {
57-
const response = await fetch( `${API_BASE_PATH}/Sports/sportsData`, {
58-
method: 'POST',
59-
headers: {
60-
'Content-Type': 'application/json',
61-
},
62-
body: JSON.stringify( { cardSet } ),
63-
} );
64-
65-
if ( response.ok && isActive ) {
66-
mutate();
67-
}
68-
} catch ( updateError ) {
69-
console.error( 'Failed to refresh sports data cache:', updateError );
70-
}
71-
};
72-
73-
refreshFromServer();
74-
75-
return () => {
76-
isActive = false;
77-
};
78-
}, [ cardSet, mutate ] );
79-
8047
const normalizedData = data ?? [];
8148
const normalizedError = error instanceof Error ? error.message : null;
8249

package-lock.json

Lines changed: 6 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)