[Vuejs]-Vue.js wait for axios response before executing another function

1👍

You can use async-await in your getCartContent() method.

Like so:

async getCartContent() {
  let token = await this.getValidToken();
  let requestHeader = {
    Authorization: "Bearer " + token
  };

This will make sure that your requestHeader will have token before it executes that line.

Leave a comment