Within the mounted
function, I am creating an action that fetches data from a Rest API and populates my table in a Vue.js component
mounted() {
UserService.getProjects().then(
(response) => {
this.isProject = true;
this.projects = response.data;
},
(error) => {
this.isProject = false;
}
);
}
However, when I click on the menu to navigate to this page, I get redirected in one second but the data is still loading. As a result, the table appears empty initially. Is there a way to first fetch the data and then redirect to this page? Any help is appreciated.
Additionally, I am using router-link
to navigate to another page