Skip to content

this.storage.removeItem is not a function #7

@rubenbonilla

Description

@rubenbonilla

This error happends when there is an old acces_token and the refresh token is outdated.
In this case directus return am HTTP 401 code, trying to execute this.storage.removeItem and throws up an error because that function is not defined in plugin.js:27.

I have fixed the error but i don't know how to make a pull request to you.

This is the code that fix this problem

plugin.js:37

        removeItem: (key) => {
          ctx.$cookies.remove(key)
          return Promise.resolve();
        }

plugin.js:55

 try {
        const { data } = await directus.auth.refresh();
        directus.auth.token = data.access_token;
      } catch (error) {
        // Nothing to do here, this will push to options.loginRoute route
      }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions