import { Module, MutationTree, ActionTree, Commit } from 'vuex'; import { StateInterface } from 'src/store'; import { axios } from 'boot/axios'; import { LoginData } from 'src/plugins/user/models' export interface Token { browser: string; expires: string; lifetime: number; platform: string; token: string; } export interface User { display_name: string | null; firstname: string; lastname: string; mail: string; roles: string[]; } export interface UserStateInterface { permissions: string[]; token: Token; user: User; userid: string; } const state: UserStateInterface = { permissions: [], token: { browser: '', expires: '', lifetime: -1, platform: '', token: '' }, user: { display_name: '', firstname: '', lastname: '', mail: '', roles: [] }, userid: '' }; const mutation: MutationTree = { setState(state: UserStateInterface, data: UserStateInterface) { state = data; } }; const actions: ActionTree = { async = login({ commit: Commit }, data: LoginData) { axios } };