File tree Expand file tree Collapse file tree 2 files changed +5
-7
lines changed
Expand file tree Collapse file tree 2 files changed +5
-7
lines changed Original file line number Diff line number Diff line change @@ -8,11 +8,9 @@ type useApiHookReturnValue<T> = {
88 data ?: T ;
99} ;
1010
11- const pollingManager = new PollingManager ( ) ;
12-
1311function useApi < T > (
1412 apiCall : apiCallParam < T > ,
15- pollingTime ?: number ,
13+ pollingTime ?: number
1614) : useApiHookReturnValue < T > {
1715 const [ isLoading , setIsLoading ] = useState < boolean > ( true ) ;
1816 const [ data , setData ] = useState < T > ( ) ;
@@ -37,12 +35,12 @@ function useApi<T>(
3735
3836 if ( pollingTime ) {
3937 // Use polling manager for rate-limited polling
40- pollingManager . addTask (
38+ PollingManager . addTask (
4139 taskId ,
4240 stableApiCall ,
4341 onSuccess ,
4442 onError ,
45- pollingTime ,
43+ pollingTime
4644 ) ;
4745 } else {
4846 // For non-polling requests, execute immediately
@@ -58,7 +56,7 @@ function useApi<T>(
5856
5957 return ( ) => {
6058 if ( taskIdRef . current ) {
61- pollingManager . removeTask ( taskIdRef . current ) ;
59+ PollingManager . removeTask ( taskIdRef . current ) ;
6260 }
6361 } ;
6462 } , [ stableApiCall , pollingTime ] ) ;
Original file line number Diff line number Diff line change @@ -164,4 +164,4 @@ class PollingManager {
164164 }
165165}
166166
167- export default PollingManager ;
167+ export default new PollingManager ( ) ;
You can’t perform that action at this time.
0 commit comments