[Vuejs]-Ionic Secure Storage get() at the start of the app

0👍

I’m spotting a problem in your token.service.ts, you are not returning nothing at: getAccessToken

// async since is returning a promise
async getAccessToken(){
    // Returning the promise.
    return storage.get(ACCESS_TOKEN_KEY)
}

Using it from the outside will look like this:

// using await because we want the promise to be solved
if ((await TokenService.getAccessToken()) !== undefined) {
 ...
}

Leave a comment