squash stuff
This commit is contained in:
		
							parent
							
								
									bd295a8e4c
								
							
						
					
					
						commit
						509fadca11
					
				
					 4 changed files with 25 additions and 31 deletions
				
			
		|  | @ -1,2 +0,0 @@ | ||||||
| VUE_APP_CONFIG_API_USER=rest api user |  | ||||||
| VUE_APP_CONFIG_API_PASSWORD=rest api password |  | ||||||
							
								
								
									
										3
									
								
								.gitignore
									
										
									
									
										vendored
									
									
								
							
							
						
						
									
										3
									
								
								.gitignore
									
										
									
									
										vendored
									
									
								
							|  | @ -23,4 +23,5 @@ yarn.lock | ||||||
| *.sln | *.sln | ||||||
| *.sw? | *.sw? | ||||||
| 
 | 
 | ||||||
| src/store/auth.js | src/store/auth.js | ||||||
|  | src/config.js | ||||||
|  | @ -1,8 +1,8 @@ | ||||||
| import Vue from 'vue'; | import Vue from 'vue'; | ||||||
| import App from './App.vue'; | import App from './App.vue'; | ||||||
|  | import { sync } from 'vuex-router-sync'; | ||||||
| import store from './store'; | import store from './store'; | ||||||
| import router from './router'; | import router from './router'; | ||||||
| import { sync } from 'vuex-router-sync'; |  | ||||||
| 
 | 
 | ||||||
| // bootstrap
 | // bootstrap
 | ||||||
| import 'jquery/dist/jquery.min.js'; | import 'jquery/dist/jquery.min.js'; | ||||||
|  |  | ||||||
|  | @ -1,13 +1,15 @@ | ||||||
| import Vue from 'vue'; | import Vue from 'vue'; | ||||||
| import Vuex from 'vuex'; | import Vuex from 'vuex'; | ||||||
| import axios from 'axios'; | import AxiosBootstrap from 'axios'; | ||||||
|  | import config from '../config'; | ||||||
| //import * as _ from 'lodash/fp';
 | //import * as _ from 'lodash/fp';
 | ||||||
| import router from '../router'; | import router from '../router'; | ||||||
| 
 | 
 | ||||||
| import getAuth from './auth'; |  | ||||||
| 
 |  | ||||||
| Vue.use(Vuex); | Vue.use(Vuex); | ||||||
| 
 | const axios = AxiosBootstrap.create({ | ||||||
|  |   baseURL: config.service.url, | ||||||
|  |   auth: config.service.auth | ||||||
|  | }); | ||||||
| 
 | 
 | ||||||
| const store = new Vuex.Store({ | const store = new Vuex.Store({ | ||||||
|   state: { |   state: { | ||||||
|  | @ -15,7 +17,6 @@ const store = new Vuex.Store({ | ||||||
|     layout: 'cards', |     layout: 'cards', | ||||||
|     loadedItems: [], |     loadedItems: [], | ||||||
|     loadedBoxes: [], |     loadedBoxes: [], | ||||||
|     apiUrl: 'https://c3lf.de/api', |  | ||||||
|   }, |   }, | ||||||
|   getters: { |   getters: { | ||||||
|     getEventSlug: state => state.route && state.route.params.event? state.route.params.event : state.events.length ? state.events[0].slug : '36C3', |     getEventSlug: state => state.route && state.route.params.event? state.route.params.event : state.events.length ? state.events[0].slug : '36C3', | ||||||
|  | @ -38,14 +39,15 @@ const store = new Vuex.Store({ | ||||||
|     replaceBoxes(state, loadedBoxes) { |     replaceBoxes(state, loadedBoxes) { | ||||||
|       state.loadedBoxes = loadedBoxes; |       state.loadedBoxes = loadedBoxes; | ||||||
|     }, |     }, | ||||||
|  |     updateItem(state, updatedItem) { | ||||||
|  |       const item = state.loadedItems.filter(({ item_uid }) => item_uid === updatedItem.item_uid)[0]; | ||||||
|  |       Object.assign(item, updatedItem); | ||||||
|  |     } | ||||||
|   }, |   }, | ||||||
|   actions: { |   actions: { | ||||||
|     async loadEvents({ commit, state }) { |     async loadEvents({ commit }) { | ||||||
|       const resp = await axios.get(`${state.apiUrl}/1/events`,  { |       const { data } = await axios.get('/1/events'); | ||||||
|         auth: getAuth(), |       commit('replaceEvents', data); | ||||||
|       }); |  | ||||||
| 
 |  | ||||||
|       commit('replaceEvents', resp.data); |  | ||||||
|     }, |     }, | ||||||
|     changeEvent({ dispatch, getters}, eventName) { |     changeEvent({ dispatch, getters}, eventName) { | ||||||
|       router.push({path: `/${eventName.slug}/${getters.getActiveView}`}); |       router.push({path: `/${eventName.slug}/${getters.getActiveView}`}); | ||||||
|  | @ -54,24 +56,17 @@ const store = new Vuex.Store({ | ||||||
|     changeView({ getters }, link) { |     changeView({ getters }, link) { | ||||||
|       router.push({path: `/${getters.getEventSlug}/${link.path}`}); |       router.push({path: `/${getters.getEventSlug}/${link.path}`}); | ||||||
|     }, |     }, | ||||||
|     async loadEventItems({ commit, state, getters }) { |     async loadEventItems({ commit, getters }) { | ||||||
|       const resp = await axios.get(`${state.apiUrl}/1/${getters.getEventSlug}/items`,  { |       const { data } = await axios.get(`/1/${getters.getEventSlug}/items`); | ||||||
|         auth: getAuth(), |       commit('replaceLoadedItems', data); | ||||||
|       }); |  | ||||||
| 
 |  | ||||||
|       commit('replaceLoadedItems', resp.data); |  | ||||||
|     }, |     }, | ||||||
|     async loadBoxes({ commit, state }) { |     async loadBoxes({ commit }) { | ||||||
|       const resp = await axios.get(`${state.apiUrl}/1/boxes`,  { |       const { data } = await axios.get('/1/boxes'); | ||||||
|         auth: getAuth(), |       commit('replaceBoxes', data); | ||||||
|       }); |  | ||||||
| 
 |  | ||||||
|       commit('replaceBoxes', resp.data); |  | ||||||
|     }, |     }, | ||||||
|     async updateItem({ getters, state }, item) { |     async updateItem({ commit, getters }, item) { | ||||||
|       axios.put(`${state.apiUrl}/1/${getters.getEventSlug}/item/${item.iid}`, item, { |       const { data } = await axios.put(`/1/${getters.getEventSlug}/item/${item.iid}`, item); | ||||||
|         auth: getAuth(), |       commit('updateItem', data); | ||||||
|       }); |  | ||||||
|     } |     } | ||||||
|   } |   } | ||||||
| }); | }); | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue