ObservationDatabase/frontend/src/store.js

60 lines
1.2 KiB
JavaScript

import Vue from "vue";
import Vuex from "vuex";
var moment = require("moment");
Vue.use(Vuex);
export default new Vuex.Store({
state: {
site: null,
tutors: [],
description: null,
type: null,
whom: null,
search: {
site: null,
tutor: null,
whom: null,
person: null,
start: moment().subtract(7, "days"),
end: moment()
}
},
mutations: {
setSite(state, newSite) {
state.site = newSite;
},
setTutors(state, newTutors) {
state.tutors = newTutors;
},
setDescription(state, newDescription) {
state.description = newDescription;
},
setType(state, newType) {
state.type = newType;
},
setWhom(state, newWhom) {
state.whom = newWhom;
},
setSearchSite(state, data) {
state.search.site = data;
},
setSearchTutor(state, data) {
state.search.tutor = data;
},
setSearchWhom(state, data) {
state.search.whom = data;
},
setSearchPerson(state, data) {
state.search.person = data;
},
setSearchStartDate(state, data) {
state.search.start = data;
},
setSearchEndDate(state, data) {
state.search.end = data;
}
},
actions: {}
});