File tree Expand file tree Collapse file tree 1 file changed +17
-12
lines changed
Expand file tree Collapse file tree 1 file changed +17
-12
lines changed Original file line number Diff line number Diff line change @@ -93,18 +93,22 @@ export const useProvidersConfigResource = (config?: SWRConfiguration) => {
9393 } ) ;
9494 }
9595
96- providerConfigsDataForRequest . forEach ( async ( item ) => {
97- const data = await fetchApiServerJson < ProviderConfigs > (
98- `/apis/${ item . url ?? '' } /${ item . version } /providerconfigs` ,
99- apiConfig ,
100- CRDRequest . jq ,
101- CRDRequest . method ,
102- CRDRequest . body ,
103- ) ;
104- if ( data ) {
105- providerConfigs . push ( data ) ;
106- }
107- } ) ;
96+ const fetchProviderConfigsData = async ( ) => {
97+ const promises = providerConfigsDataForRequest . map ( async ( item ) => {
98+ const data = await fetchApiServerJson < ProviderConfigs > (
99+ `/apis/${ item . url ?? '' } /${ item . version } /providerconfigs` ,
100+ apiConfig ,
101+ CRDRequest . jq ,
102+ CRDRequest . method ,
103+ CRDRequest . body ,
104+ ) ;
105+ if ( data ) {
106+ providerConfigs . push ( data ) ;
107+ }
108+ } ) ;
109+
110+ await Promise . all ( promises ) ;
111+ } ;
108112
109113 const providerConfigs : ProviderConfigs [ ] = [ ] ;
110114
@@ -140,6 +144,7 @@ export const useProvidersConfigResource = (config?: SWRConfiguration) => {
140144 const fetchDataAndUpdateState = async ( ) => {
141145 setIsLoading ( true ) ;
142146 try {
147+ await fetchProviderConfigsData ( ) ;
143148 const finalData = await fetchProviderConfigs ( ) ;
144149
145150 setConfigs ( finalData ) ;
You can’t perform that action at this time.
0 commit comments