From bdcf9668b7875f3d0b27400d3e603f5877c2b3c5 Mon Sep 17 00:00:00 2001 From: Ferdinand Thiessen Date: Fri, 6 Nov 2020 01:12:03 +0100 Subject: [PATCH] Sync with backend --- src/boot/filter.ts | 8 ++++++-- src/flaschengeist.d.ts | 2 +- src/pages/Login.vue | 6 ++---- src/plugins/user/models.ts | 6 ++++++ 4 files changed, 15 insertions(+), 7 deletions(-) diff --git a/src/boot/filter.ts b/src/boot/filter.ts index 6ae748e..559600c 100644 --- a/src/boot/filter.ts +++ b/src/boot/filter.ts @@ -16,9 +16,13 @@ export default boot(({ Vue }) => { if (H.length == 1) H = `0${H}`; let M = date.getMinutes().toString(); if (M.length == 1) M = `0${M}`; - let S = '' + let S = ''; if (seconds) { - S = ':' + (date.getSeconds() > 9 ? date.getSeconds().toString() : `0${date.getSeconds().toString()}`); + S = + ':' + + (date.getSeconds() > 9 + ? date.getSeconds().toString() + : `0${date.getSeconds().toString()}`); } return `${H}:${M}${S} ${formatDate(date)}`; }); diff --git a/src/flaschengeist.d.ts b/src/flaschengeist.d.ts index 4203fde..8fc1a92 100644 --- a/src/flaschengeist.d.ts +++ b/src/flaschengeist.d.ts @@ -13,7 +13,7 @@ declare namespace FG { firstname: string; lastname: string; mail: string; - roles: Array; + roles: Array; } type Permission = string; interface Role { diff --git a/src/pages/Login.vue b/src/pages/Login.vue index c67012c..32a7097 100644 --- a/src/pages/Login.vue +++ b/src/pages/Login.vue @@ -38,7 +38,7 @@ import { defineComponent, ref } from '@vue/composition-api'; export default defineComponent({ // name: 'PageName' - setup(_, ctx) { + setup(_, { root }) { const userid = ref(''); const password = ref(''); const rules = [ @@ -46,8 +46,7 @@ export default defineComponent({ ]; function doLogin() { - console.log(userid.value, password.value); - ctx.root.$store + root.$store .dispatch('session/login', { userid: userid.value, password: password.value @@ -55,7 +54,6 @@ export default defineComponent({ .catch(error => { console.warn(error); }); - //ctx.root.$router.push({ name: 'main' }); } return { userid, password, doLogin, rules }; diff --git a/src/plugins/user/models.ts b/src/plugins/user/models.ts index c743f7d..54a1dc4 100644 --- a/src/plugins/user/models.ts +++ b/src/plugins/user/models.ts @@ -6,4 +6,10 @@ export interface LoginData { export interface LoginResponse { user: FG.User; session: FG.Session; + permissions: FG.Permission[]; +} + +//eslint-disable-next-line @typescript-eslint/no-unsafe-member-access +export interface CurrentUserResponse extends FG.User { + permissions: FG.Permission[]; }