From d6e7b814d4ce57416a413db645304c8817185703 Mon Sep 17 00:00:00 2001 From: JKamsker Date: Sun, 18 Sep 2022 23:37:29 +0200 Subject: [PATCH] Extracted wakeup function --- src/index.js | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/index.js b/src/index.js index bab53d2..011c574 100644 --- a/src/index.js +++ b/src/index.js @@ -12,9 +12,7 @@ import { GoogleReCaptcha, } from 'react-google-recaptcha-v3' -fetch(`${process.env.REACT_APP_APISERVER}/api/v2/WakeUpNeo`).then((data) => - console.log('Woke up, im ready to serve :D'), -) +WakeUp(); ReactGA.initialize('UA-174657678-1') ReactGA.pageview(window.location.pathname + window.location.search) @@ -45,3 +43,13 @@ ReactDOM.render( // unregister() to register() below. Note this comes with some pitfalls. // Learn more about service workers: https://bit.ly/CRA-PWA serviceWorker.unregister() + + +async function WakeUp() { + try{ + await fetch(`${process.env.REACT_APP_APISERVER}/api/v2/WakeUpNeo`) + console.log("Woke up") + }catch(ex){ + console.log("Error occured: "+ ex) + } +} \ No newline at end of file