gsklee / ngStorage

localStorage and sessionStorage done right for AngularJS.
MIT License
2.34k stars 461 forks source link

is there a way I can automatically reset the variable of the $storage.counter at 12am at night ? #255

Open PManager1 opened 7 years ago

PManager1 commented 7 years ago

basically I'm trying to do this thing in my app where the user can make api calls only 3 times in 24 hours. after that it will have to wait until next day.

I know its best to save it in the database, but for now, I just wanna do it easy way and then later save it in the db.

OscarBarrett commented 7 years ago

The easiest way would be to keep track of the last time an API call was made (persisted to $storage), and reset your counter if it has been more than 24 hours.