[Vuejs]-Strange URL parameters added automatically

0👍

The issue was that I was setting vue-router parseQuery as an async function like this:

async parseQuery(q) {
   let queryString = q;
   if (q.includes('token')) {
     const data = JSON.parse(`{"${decodeURI(q.replace(/&/g, '","').replace(/=/g, '":"'))}"}`);
     const jwtDecodedToken = jwtDecode(data.token);
     store.dispatch('Auth/setToken', `Bearer ${data.token}`);
     await store.dispatch('Auth/login');
     router.push({
       name: 'complete',
       params: {
         id: jwtDecodedToken.order_id, confirmNavigation: true,
       },
     });
     queryString = '';
   }
   return queryString;
 },

I guess vue-router doesn’t support to have parseQuery as async function

Leave a comment