const state = { currencies: { default: [], values: this.default }, loadingCurrencies: { default: false, value: true } } const getters = { /** * * @param {*} state */ currencies(state) { return state.currencies.values }, /** * * @param {*} state */ loadingCurrencies(state) { return state.loadingCurrencies.value } } const mutations = { /** * * @param {*} state * @param {*} payload */ setCurrencies(state, payload) { state.currencies.values = [...payload] }, /** * * @param {*} state * @param {*} payload */ setLoadingCurrencies(state, payload) { state.loadingCurrencies.value = !!payload } } const actions = { /** * * @param {*} param0 * @param {*} payload */ initCurrencies({ commit }, payload) { commit('setCurrencies', payload) commit('setLoadingCurrencies', false) }, /** * * @param {*} param0 */ setCurrencies({ commit }, payload) { commit('setCurrencies', payload) } } export default { state, getters, mutations, actions }