mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
start refactoring
This commit is contained in:
parent
e28d17a131
commit
c77af0bc4a
@ -203,7 +203,6 @@ export default {
|
||||
},
|
||||
methods: {
|
||||
init() {
|
||||
console.log('init')
|
||||
this.fetchData();
|
||||
},
|
||||
openModal() {
|
||||
@ -282,7 +281,7 @@ export default {
|
||||
if (this.showMyCalendar) {
|
||||
this.calendarOptions.eventSources.push(this.calendarEvents.userCalendar);
|
||||
}
|
||||
// console.log(this.calendarOptions.eventSources);
|
||||
console.log('eventSources', this.calendarOptions.eventSources);
|
||||
},
|
||||
toggleMyCalendar(value) {
|
||||
this.showMyCalendar = value;
|
||||
@ -450,7 +449,7 @@ export default {
|
||||
color: "#3788d8"
|
||||
};
|
||||
// console.log(copiedEvents);
|
||||
|
||||
|
||||
// Add to the calendar
|
||||
let newEvents = this.calendarEvents.new.events;
|
||||
newEvents.push(...copiedEvents.events);
|
||||
@ -459,7 +458,7 @@ export default {
|
||||
color: "#3788d8"
|
||||
};
|
||||
this.updateEventsSource();
|
||||
|
||||
|
||||
// Set the last new date
|
||||
this.lastNewDate = new Date(copiedEvents.events[copiedEvents.events.length - 1].start);
|
||||
|
||||
|
@ -1,17 +1,21 @@
|
||||
import 'es6-promise/auto';
|
||||
import { createStore } from 'vuex';
|
||||
import { postCalendarRange, patchCalendarRange, deleteCalendarRange } from '../_api/api';
|
||||
import { deleteCalendarRange, fetchCalendar, fetchCalendarRangesByUser, patchCalendarRange, postCalendarRange } from '../_api/api';
|
||||
|
||||
const debug = process.env.NODE_ENV !== 'production';
|
||||
|
||||
const store = createStore({
|
||||
strict: debug,
|
||||
state: {
|
||||
newCalendarRanges: [],
|
||||
updateCalendarRanges: [],
|
||||
deleteCalendarRanges: []
|
||||
newCalendarRanges: [],
|
||||
updateCalendarRanges: [],
|
||||
deleteCalendarRanges: [],
|
||||
userRanges: [],
|
||||
},
|
||||
mutations: {
|
||||
setUserRanges(state, payload) {
|
||||
state.userRanges = payload
|
||||
},
|
||||
updateRange(state, payload) {
|
||||
state.updateCalendarRanges.push({
|
||||
id: payload.event.extendedProps.calendarRangeId,
|
||||
@ -53,8 +57,19 @@ const store = createStore({
|
||||
)
|
||||
state.deleteCalendarRanges = filteredCollection;
|
||||
},
|
||||
addUserRange(state, payload) {
|
||||
state.userRanges.push(payload);
|
||||
}
|
||||
},
|
||||
actions: {
|
||||
setUserRanges({ commit }) {
|
||||
console.log('userId', window.userId);
|
||||
fetchCalendarRangesByUser(window.userId)
|
||||
.then((ranges) => {
|
||||
console.log('ranges', ranges.results);
|
||||
commit('setUserRanges', ranges.results);
|
||||
})
|
||||
},
|
||||
createRange({ commit }, payload) {
|
||||
// console.log('### action createRange', payload);
|
||||
commit('addRange', payload);
|
||||
@ -85,5 +100,7 @@ const store = createStore({
|
||||
}
|
||||
});
|
||||
|
||||
store.dispatch('setUserRanges');
|
||||
|
||||
|
||||
export default store;
|
||||
|
Loading…
x
Reference in New Issue
Block a user