[Vuejs]-Send api call before refreshing

1👍

You are correct. The axios.post() is asynchonous, so the page is redirected before the post completes. Try something like this:

axios.post('/api/persons/unique/alias', {
        params: {
            id:123
        }
    })
    .then((response) => {
        window.location.href = window.location.pathname + '?lang=' + this.language;
    });

Leave a comment