I want to make table refresh automatically with latest api uri request and return data.(actually refresh in every 5 sec)
I think if i use last api requst uri and setInterval function on mounted() method, it will be working.
I wonder,
thanks
@dongwooklee9 You should avoid trying to that because some well known API services usually have rate limit restriction on calling the API like that (especially every 5 sec). Instead, you should always design the app to request the data only when it is needed.
setTimeout to call refresh method in Vuetable. I agree with @ratiw unless you manage the API serverside as well, so you know what the rate limits are ;-)
Thanks for your detailed answers.
Explaining more about my project, It's like a Uber-eat, It's to get the order every second and link the driver with the order automatically in normal situation. I want to use the table on admin page monitoring the order-delivery, to find out some stuck order and solve it on the table manually
I'm planning to use this table to check the orders
I can modify the setTimeout to 5sec, 10sec, 30sec.
I will try it and share the result!
Please feel free any comments or advice
Thanks you @denjaland and @ratiw!
If it's an option, I would use a DB such as MongoDB, PubNub or RethinkDB, and have it update the contents of the table in realtime. You could then save the last time the order was updated (epoch or something like that), and you could check on that value in an interval. That's just one way to do it.
Another way could be to use socket.io or something like it, and whenever the data changes, you get notified and update the table. Then you could have the interval running on the client checking for any order older than whatever time period you designate.
Anyone try/think of using CouchDB/PouchDB in this context? I am using it on another project. For example and event is fired with DB updates at which point you can refresh the table.
I am just now looking at wiring up vuetable with PouchDB api endpoint.
Most helpful comment
If it's an option, I would use a DB such as MongoDB, PubNub or RethinkDB, and have it update the contents of the table in realtime. You could then save the last time the order was updated (epoch or something like that), and you could check on that value in an interval. That's just one way to do it.
Another way could be to use socket.io or something like it, and whenever the data changes, you get notified and update the table. Then you could have the interval running on the client checking for any order older than whatever time period you designate.