Sync with backend

This commit is contained in:
Ferdinand Thiessen 2020-11-06 01:12:03 +01:00
parent 1d598b5787
commit bdcf9668b7
4 changed files with 15 additions and 7 deletions

View File

@ -16,9 +16,13 @@ export default boot(({ Vue }) => {
if (H.length == 1) H = `0${H}`; if (H.length == 1) H = `0${H}`;
let M = date.getMinutes().toString(); let M = date.getMinutes().toString();
if (M.length == 1) M = `0${M}`; if (M.length == 1) M = `0${M}`;
let S = '' let S = '';
if (seconds) { 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)}`; return `${H}:${M}${S} ${formatDate(date)}`;
}); });

View File

@ -13,7 +13,7 @@ declare namespace FG {
firstname: string; firstname: string;
lastname: string; lastname: string;
mail: string; mail: string;
roles: Array<Role>; roles: Array<string>;
} }
type Permission = string; type Permission = string;
interface Role { interface Role {

View File

@ -38,7 +38,7 @@ import { defineComponent, ref } from '@vue/composition-api';
export default defineComponent({ export default defineComponent({
// name: 'PageName' // name: 'PageName'
setup(_, ctx) { setup(_, { root }) {
const userid = ref(''); const userid = ref('');
const password = ref(''); const password = ref('');
const rules = [ const rules = [
@ -46,8 +46,7 @@ export default defineComponent({
]; ];
function doLogin() { function doLogin() {
console.log(userid.value, password.value); root.$store
ctx.root.$store
.dispatch('session/login', { .dispatch('session/login', {
userid: userid.value, userid: userid.value,
password: password.value password: password.value
@ -55,7 +54,6 @@ export default defineComponent({
.catch(error => { .catch(error => {
console.warn(error); console.warn(error);
}); });
//ctx.root.$router.push({ name: 'main' });
} }
return { userid, password, doLogin, rules }; return { userid, password, doLogin, rules };

View File

@ -6,4 +6,10 @@ export interface LoginData {
export interface LoginResponse { export interface LoginResponse {
user: FG.User; user: FG.User;
session: FG.Session; 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[];
} }