From 1cae6718ea529805c56dbb00adb23137955e05db Mon Sep 17 00:00:00 2001 From: Mikkel Friis Date: Wed, 14 Jun 2023 20:22:02 +0200 Subject: [PATCH] fix: remove asynchronous callback --- src/App.tsx | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/src/App.tsx b/src/App.tsx index 072b05dd..987ff9b6 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -24,7 +24,7 @@ export const App: FC<{}> = props => Nitro.bootstrap(); } - const handler = useCallback(async (event: NitroEvent) => + const handler = useCallback((event: NitroEvent) => { switch(event.type) { @@ -82,19 +82,20 @@ export const App: FC<{}> = props => if(assetUrls && assetUrls.length) for(const url of assetUrls) urls.push(NitroConfiguration.interpolate(url)); - const status = await GetAssetManager().downloadAssets(urls); - - if(status) - { - GetCommunication().init(); + GetAssetManager().downloadAssets(urls) + .then((status) => { + if(status) + { + GetCommunication().init(); - setPercent(prevValue => (prevValue + 20)) - } - else - { - setIsError(true); - setMessage('Assets Failed'); - } + setPercent(prevValue => (prevValue + 20)) + } + else + { + setIsError(true); + setMessage('Assets Failed'); + } + }) return; } }