mirror of
				https://github.com/crater-invoice/crater.git
				synced 2025-10-30 21:21:09 -04:00 
			
		
		
		
	init crater
This commit is contained in:
		
							
								
								
									
										13
									
								
								resources/assets/js/store/modules/user/actions.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										13
									
								
								resources/assets/js/store/modules/user/actions.js
									
									
									
									
									
										Normal 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) | ||||
|     }) | ||||
|   }) | ||||
| } | ||||
							
								
								
									
										1
									
								
								resources/assets/js/store/modules/user/getters.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								resources/assets/js/store/modules/user/getters.js
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1 @@ | ||||
| export const currentUser = (state) => state.currentUser | ||||
							
								
								
									
										22
									
								
								resources/assets/js/store/modules/user/index.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										22
									
								
								resources/assets/js/store/modules/user/index.js
									
									
									
									
									
										Normal 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 | ||||
| } | ||||
							
								
								
									
										3
									
								
								resources/assets/js/store/modules/user/mutation-types.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										3
									
								
								resources/assets/js/store/modules/user/mutation-types.js
									
									
									
									
									
										Normal 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' | ||||
							
								
								
									
										13
									
								
								resources/assets/js/store/modules/user/mutations.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										13
									
								
								resources/assets/js/store/modules/user/mutations.js
									
									
									
									
									
										Normal 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 | ||||
|   } | ||||
| } | ||||
		Reference in New Issue
	
	Block a user