dimanche 30 août 2020

Way of passing API data to the view asynchronously?

I'm super new to Laravel and I was wondering what the best optimization for the following issue would be.

Right now I have a call to an external API to a project management application that retrieves a list of tasks. This call occurs in my controller and the data is then passed to a dashboard view to be rendered with Vue. I'd normally just have this API call happen entirely on the front-end, but the project management application uses OAuth 2, so I'm authenticating and calling the endpoint on the server-side.

This technically works fine, but sometimes loading my app's dashboard takes a little longer to load than I'd like. I believe the culprit is the fact that the page makes the API call on each reload.

My question is this: is there a way to pass the API response data to the view asynchronously? In my ideal scenario the view would load with just a loading icon and then show the tasks once they were received from the project management server. Like I said: I'd know how to do this using AJAX and the like, but there's an access token and OAuth involved.

Hopefully that makes sense and isn't a totally silly question, but any suggestions at this time would be helpful. Thanks!



from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/3luWvAx
via IFTTT

Aucun commentaire:

Enregistrer un commentaire