1
0
mirror of https://gitlab.com/bramw/baserow.git synced 2024-11-21 23:37:55 +00:00
bramw_baserow/web-frontend/modules/builder/store/pageParameter.js

33 lines
560 B
JavaScript

import Vue from 'vue'
const state = {}
const mutations = {
SET_PARAMETER(state, { page, name, value }) {
if (!page.parameters) {
Vue.set(page, 'parameters', {})
}
page.parameters = { ...page.parameters, [name]: value }
},
}
const actions = {
setParameter({ commit }, { page, name, value }) {
commit('SET_PARAMETER', { page, name, value })
},
}
const getters = {
getParameters: (state) => (page) => {
return page.parameters || {}
},
}
export default {
namespaced: true,
state,
getters,
actions,
mutations,
}