CronImplementation 3: tested
This commit is contained in:
parent
b3282a360c
commit
e0f400b761
1 changed files with 9 additions and 5 deletions
|
|
@ -37,7 +37,8 @@ class App extends React.Component<any,any> {
|
||||||
CheckCron(lastCron: string) {
|
CheckCron(lastCron: string) {
|
||||||
let cronDate = new Date(lastCron).getDate();
|
let cronDate = new Date(lastCron).getDate();
|
||||||
let now = new Date().getDate();
|
let now = new Date().getDate();
|
||||||
if (cronDate < now) {
|
console.log(cronDate, now);
|
||||||
|
if (cronDate != now) {
|
||||||
return(
|
return(
|
||||||
<div className="cron">
|
<div className="cron">
|
||||||
<div id="cronMessage"> Welcome back! Please check your tasks for the last day and hit continue to get your daily rewards. </div>
|
<div id="cronMessage"> Welcome back! Please check your tasks for the last day and hit continue to get your daily rewards. </div>
|
||||||
|
|
@ -50,14 +51,17 @@ class App extends React.Component<any,any> {
|
||||||
return null
|
return null
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
runCron() {
|
async runCron() {
|
||||||
console.log("running cron");
|
console.log("running cron");
|
||||||
makeCronReq(this.username, this.credentials)
|
try {
|
||||||
.then(res => {
|
let response = await makeCronReq(this.username, this.credentials);
|
||||||
this.setState({
|
this.setState({
|
||||||
needCron: false,
|
needCron: false,
|
||||||
})
|
})
|
||||||
});
|
} catch (error) {
|
||||||
|
console.log(error);
|
||||||
|
new Notice("There was an error running the cron. Please try again later.");
|
||||||
|
}
|
||||||
this.reloadData();
|
this.reloadData();
|
||||||
}
|
}
|
||||||
async reloadData() {
|
async reloadData() {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue