init crater

This commit is contained in:
Mohit Panjwani
2019-11-11 12:16:00 +05:30
commit bdf2ba51d6
668 changed files with 158503 additions and 0 deletions

View File

@ -0,0 +1,13 @@
import * as types from './mutation-types'
import Ls from '@/services/ls'
export const updateCurrentUser = ({ commit, dispatch, state }, data) => {
return new Promise((resolve, reject) => {
axios.post('/api/hq/users', data).then((response) => {
commit(types.UPDATE_CURRENT_USER, response.data.user)
resolve(response)
}).catch((err) => {
reject(err)
})
})
}

View File

@ -0,0 +1 @@
export const currentUser = (state) => state.currentUser

View File

@ -0,0 +1,22 @@
import mutations from './mutations'
import * as actions from './actions'
import * as getters from './getters'
const initialState = {
currentUser: null,
roles: [],
permissions: [],
stations: []
}
export default {
namespaced: true,
state: initialState,
getters: getters,
actions: actions,
mutations: mutations
}

View File

@ -0,0 +1,3 @@
export const RESET_CURRENT_USER = 'RESET_CURRENT_USER'
export const BOOTSTRAP_CURRENT_USER = 'BOOTSTRAP_CURRENT_USER'
export const UPDATE_CURRENT_USER = 'UPDATE_CURRENT_USER'

View File

@ -0,0 +1,13 @@
import * as types from './mutation-types'
export default {
[types.RESET_CURRENT_USER] (state, user) {
state.currentUser = null
},
[types.BOOTSTRAP_CURRENT_USER] (state, user) {
state.currentUser = user
},
[types.UPDATE_CURRENT_USER] (state, user) {
state.currentUser = user
}
}