Skip to content

how to make router redirect to login when the auth state is kept by store? #3

@funkyLover

Description

@funkyLover

I want store to keep the state of auth or user info, also keep auth state in cookie or localstorage.
when user open the page, try to get the auth from cookie or localstorage and make it into store.
and make router redirect to login when user not login or can not get auth locally.
should I do that within router.beforeEach? but how could I get the store.state.auth

any advice?

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