How to use the js-cookie function in js-cookie

To help you get started, we’ve selected a few js-cookie examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Braised-Cakes / myh5 / backstage / src / router / index.js View on Github external
routes.beforeEach((to, from, next) => {
    let token = Cookies('username');
    if (!to.name) {
        next({
            name: 'list'
        });
    } else if (to.name == 'login') {
        if (!token || !store.state.auth.username) {
            next();
        } else {
            next({
                name: 'list'
            });
        }
    } else if (to.params.status == 2 || (to.matched.some(record => record.meta.requiresAuth) && (!token || token === null))) {
        next({
            path: '/login'
        });