diff options
| author | Pitu <[email protected]> | 2019-03-15 07:17:35 +0000 |
|---|---|---|
| committer | Pitu <[email protected]> | 2019-03-15 07:17:35 +0000 |
| commit | 85ed48219e123d6aed0b028becc2849169bb4409 (patch) | |
| tree | a9e6b2d1dea6c99318f86d82aba4884a115a5773 /src | |
| parent | This should fix credential leaking 😓 (diff) | |
| download | host.fuwn.me-85ed48219e123d6aed0b028becc2849169bb4409.tar.xz host.fuwn.me-85ed48219e123d6aed0b028becc2849169bb4409.zip | |
This is not needed anymore
Diffstat (limited to 'src')
| -rw-r--r-- | src/site/layouts/default.vue | 53 |
1 files changed, 0 insertions, 53 deletions
diff --git a/src/site/layouts/default.vue b/src/site/layouts/default.vue index afa8eb9..41c3ebd 100644 --- a/src/site/layouts/default.vue +++ b/src/site/layouts/default.vue @@ -21,14 +21,6 @@ export default { console.log(`%c lolisafe %c v${this.config.version} %c`, 'background:#35495e ; padding: 1px; border-radius: 3px 0 0 3px; color: #fff', 'background:#ff015b; padding: 1px; border-radius: 0 3px 3px 0; color: #fff', 'background:transparent'); }, created() { - Vue.prototype.$search = (term, list, options) => { - return new Promise(resolve => { - const run = new Fuse(list, options); - const results = run.search(term); - return resolve(results); - }); - }; - Vue.prototype.$onPromiseError = (error, logout = false) => { this.processCatch(error, logout); }; @@ -36,28 +28,6 @@ export default { Vue.prototype.$showToast = (text, error, duration) => { this.showToast(text, error, duration); }; - - Vue.prototype.$logOut = () => { - this.$store.commit('user', null); - this.$store.commit('loggedIn', false); - this.$store.commit('token', null); - }; - - this.$router.beforeEach((to, from, next) => { - if (this.$store.state.loggedIn) return next(); - if (process.browser) { - if (localStorage && localStorage.getItem('lolisafe-token')) return this.tryToLogin(next, `/login?redirect=${to.path}`); - } - - for (const match of to.matched) { - if (protectedRoutes.includes(match.path)) { - if (this.$store.state.loggedIn === false) return next(`/login?redirect=${to.path}`); - } - } - - return next(); - }); - if (process.browser) this.tryToLogin(); }, methods: { showToast(text, error, duration) { @@ -81,29 +51,6 @@ export default { console.error(error); this.showToast('Something went wrong, please check the console :(', true, 5000); } - }, - tryToLogin(next, destination) { - if (process.browser) this.$store.commit('token', localStorage.getItem('lolisafe-token')); - this.axios.get(`${this.config.baseURL}/verify`).then(res => { - this.$store.commit('user', res.data.user); - this.$store.commit('loggedIn', true); - if (next) return next(); - return null; - }).catch(error => { - if (error.response && error.response.status === 520) return; - if (error.response && error.response.status === 429) { - setTimeout(() => { - this.tryToLogin(next, destination); - }, 1000); - return next(false); - } - this.$store.commit('user', null); - this.$store.commit('loggedIn', false); - this.$store.commit('token', null); - if (next && destination) return next(destination); - if (next) return next('/'); - return null; - }); } } }; |