Remove unneeded files
This commit is contained in:
parent
0cdfe7f11c
commit
ed41acfdd9
|
@ -1,25 +0,0 @@
|
||||||
import axios from 'axios';
|
|
||||||
import { ActionTree } from 'vuex';
|
|
||||||
import { StateInterface } from '../index';
|
|
||||||
import { UserStateInterface } from './state';
|
|
||||||
|
|
||||||
const actions: ActionTree<UserStateInterface, StateInterface> = {
|
|
||||||
login ({ commit }, payload): any {
|
|
||||||
axios.post("/auth", {
|
|
||||||
userid: payload.userid,
|
|
||||||
password: payload.password
|
|
||||||
}).then(function (response) {
|
|
||||||
let token = (<UserStateInterface>response.data).token;
|
|
||||||
console.log(token);
|
|
||||||
if (token)
|
|
||||||
token.expires = new Date(token.expires);
|
|
||||||
commit('setUser', (<UserStateInterface>response.data).user);
|
|
||||||
commit('setToken', token);
|
|
||||||
commit('setPermissions', (<UserStateInterface>response.data).permissions);
|
|
||||||
}).catch(function (error) {
|
|
||||||
console.error(error);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
export default actions;
|
|
|
@ -1,12 +0,0 @@
|
||||||
import { GetterTree } from 'vuex';
|
|
||||||
import { StateInterface } from '../index';
|
|
||||||
import { UserStateInterface } from './state';
|
|
||||||
|
|
||||||
const getters: GetterTree<UserStateInterface, StateInterface> = {
|
|
||||||
someAction (/* context */) {
|
|
||||||
console.log("GOOOOOOOOOOOOOOOOOOO");
|
|
||||||
// your code
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
export default getters;
|
|
|
@ -1,16 +0,0 @@
|
||||||
import { Module } from 'vuex';
|
|
||||||
import { StateInterface } from '../index';
|
|
||||||
import state, { UserStateInterface } from './state';
|
|
||||||
import actions from './actions';
|
|
||||||
import getters from './getters';
|
|
||||||
import mutations from './mutations';
|
|
||||||
|
|
||||||
const exampleModule: Module<UserStateInterface, StateInterface> = {
|
|
||||||
namespaced: true,
|
|
||||||
actions,
|
|
||||||
getters,
|
|
||||||
mutations,
|
|
||||||
state
|
|
||||||
};
|
|
||||||
|
|
||||||
export default exampleModule;
|
|
|
@ -1,16 +0,0 @@
|
||||||
import { MutationTree } from 'vuex';
|
|
||||||
import { TokenInterface, UserInterface, UserStateInterface } from './state';
|
|
||||||
|
|
||||||
const mutation: MutationTree<UserStateInterface> = {
|
|
||||||
setToken (state: UserStateInterface, token: TokenInterface) {
|
|
||||||
state.token = token
|
|
||||||
},
|
|
||||||
setUser (state: UserStateInterface, user: UserInterface) {
|
|
||||||
state.user = user
|
|
||||||
},
|
|
||||||
setPermissions (state: UserStateInterface, permissions: Array<string>) {
|
|
||||||
state.permissions = permissions
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
export default mutation;
|
|
|
@ -1,29 +0,0 @@
|
||||||
export interface TokenInterface {
|
|
||||||
token: string,
|
|
||||||
expires: Date,
|
|
||||||
lifetime: number,
|
|
||||||
browser: string,
|
|
||||||
platform: string
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface UserInterface {
|
|
||||||
display_name: string | null,
|
|
||||||
firstname: string,
|
|
||||||
lastname: string,
|
|
||||||
mail: string | null,
|
|
||||||
roles: Array<string>
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface UserStateInterface {
|
|
||||||
token: TokenInterface | null,
|
|
||||||
user: UserInterface | null,
|
|
||||||
permissions: Array<string>
|
|
||||||
};
|
|
||||||
|
|
||||||
const state: UserStateInterface = {
|
|
||||||
token: null,
|
|
||||||
user: null,
|
|
||||||
permissions: []
|
|
||||||
};
|
|
||||||
|
|
||||||
export default state;
|
|
Loading…
Reference in New Issue