How to use the san-router.router.locator function in san-router

To help you get started, we’ve selected a few san-router 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 ecomfe / san-realworld-app / src / article / components / meta.js View on Github external
toggleFollow() {
        if (!this.data.get('isAuthenticated')) {
            router.locator.redirect('/login');
            return;
        }

        let author = this.data.get('article.author');
        this.actions[author.following ? 'unfollow' : 'follow'](author.username)
            .then(data => {
                this.actions.setAuthor(data.profile);
                console.log(data.profile)
            });
    },
github ecomfe / san-realworld-app / src / user / setting.js View on Github external
logout() {
        this.actions.logout();
        router.locator.redirect('/');
    }
}))
github ecomfe / san-realworld-app / src / article / edit.js View on Github external
.then(data => {
                if (data.errors) {
                    this.data.set('inProgress', null);
                    return;
                }

                router.locator.redirect(`/article/${data.article.slug}`);
            });
    },
github ecomfe / santd / site / src / index.js View on Github external
handleRedirect(item) {
        if (item.key) {
            router.locator.redirect(item.key);
        }
    }
}
github ecomfe / san-realworld-app / src / user / register.js View on Github external
this.actions.register({username, email, password}).then(data => {
            if (data.user) {
                router.locator.redirect('/');
            }
        });
    }
github ecomfe / san-realworld-app / src / user / login.js View on Github external
this.actions.login({email, password}).then(data => {
            if (data.user) {
                router.locator.redirect('/');
            }
        });
    }
github PaddlePaddle / VisualDL / frontend / src / common / util / routeTo.js View on Github external
export function routeTo(url, params = {}) {
  let paramsArr = Object.keys(params).map((key) => `${key}=${params[key]}`);
  let urlParams = (url.indexOf('?') > -1 ? '&' : '?') + paramsArr.join('&');

  router.locator.redirect(urlParams.length > 1 ? `${url}${urlParams}` : url);
}

san-router

Router for San

MIT
Latest version published 1 year ago

Package Health Score

52 / 100
Full package analysis

Similar packages