stash events admin frontend
This commit is contained in:
parent
c6ddbfe7b8
commit
546e49e50e
6 changed files with 131 additions and 10 deletions
|
@ -54,6 +54,7 @@ const store = createStore({
|
|||
afterInitHandlers: [],
|
||||
|
||||
showAddBoxModal: false,
|
||||
showAddEventModal: false,
|
||||
test: ['foo', 'bar', 'baz'],
|
||||
|
||||
shippingVoucherTypes: {
|
||||
|
@ -179,6 +180,12 @@ const store = createStore({
|
|||
closeAddBoxModal(state) {
|
||||
state.showAddBoxModal = false;
|
||||
},
|
||||
openAddEventModal(state) {
|
||||
state.showAddEventModal = true;
|
||||
},
|
||||
closeAddEventModal(state) {
|
||||
state.showAddEventModal = false;
|
||||
},
|
||||
createToast(state, {title, message, color}) {
|
||||
var toast = {title, message, color, key: state.keyIncrement}
|
||||
state.toasts.push(toast);
|
||||
|
@ -321,6 +328,18 @@ const store = createStore({
|
|||
if (data && success)
|
||||
commit('replaceEvents', data);
|
||||
},
|
||||
async createEvent({commit, dispatch, state}, event) {
|
||||
const {data, success} = await http.post('/2/events/', event, state.user.token);
|
||||
if (data && success)
|
||||
commit('replaceEvents', [...state.events, data]);
|
||||
},
|
||||
async deleteEvent({commit, dispatch, state}, event_id) {
|
||||
const {data, success} = await http.delete(`/2/events/${event_id}/`, state.user.token);
|
||||
if (success) {
|
||||
await dispatch('loadEvents')
|
||||
commit('replaceEvents', [...state.events.filter(e => e.eid !== event_id)])
|
||||
}
|
||||
},
|
||||
async fetchTicketStates({commit, state}) {
|
||||
if (!state.user.token) return;
|
||||
if (state.fetchedData.states > Date.now() - 1000 * 60 * 60 * 24) return;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue