53 lines
1.1 KiB
TypeScript
53 lines
1.1 KiB
TypeScript
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<UserStateInterface> = {
|
|
setState(state: UserStateInterface, data: UserStateInterface) {
|
|
state = data;
|
|
}
|
|
};
|
|
|
|
const actions: ActionTree<UserStateInterface, StateInterface> = {
|
|
async = login({ commit: Commit }, data: LoginData) {
|
|
axios
|
|
}
|
|
};
|