T
TanStack3y ago
flat-fuchsia

cron job refetch

Is there a way to refetch at a certain point in the day? For example if I know data is updated every hour at 1 minute past and 31 minutes past then I want to fetch at these given times.
3 Replies
other-emerald
other-emerald3y ago
Not out of the box I don’t think. I imagine you’ll need to handle the time of day concern yourself and call refetch
genetic-orange
genetic-orange3y ago
Use setInterval (e.g 60_000 = 1 min) + define reactive variable for ‘enabled’ option. Get time from new Date() and when it satisfies your condition set your variable to true or just call refetch instead. As I know, there is no solution working as cron out of box
other-emerald
other-emerald3y ago
I think refetch is a better solution here than playing with a reactive enabled option in my opinion

Did you find this page helpful?