From e0f400b761df61ba08be65c01e7f7862c7ad0d33 Mon Sep 17 00:00:00 2001 From: Zain Date: Mon, 1 Nov 2021 11:41:31 +0530 Subject: [PATCH] CronImplementation 3: tested --- src/view/App.tsx | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/view/App.tsx b/src/view/App.tsx index b8f8814..c49cae7 100644 --- a/src/view/App.tsx +++ b/src/view/App.tsx @@ -37,7 +37,8 @@ class App extends React.Component { CheckCron(lastCron: string) { let cronDate = new Date(lastCron).getDate(); let now = new Date().getDate(); - if (cronDate < now) { + console.log(cronDate, now); + if (cronDate != now) { return(
Welcome back! Please check your tasks for the last day and hit continue to get your daily rewards.
@@ -50,14 +51,17 @@ class App extends React.Component { return null }; } - runCron() { + async runCron() { console.log("running cron"); - makeCronReq(this.username, this.credentials) - .then(res => { + try { + let response = await makeCronReq(this.username, this.credentials); this.setState({ needCron: false, }) - }); + } catch (error) { + console.log(error); + new Notice("There was an error running the cron. Please try again later."); + } this.reloadData(); } async reloadData() {