4
2
mirror of https://github.com/getbible/app.git synced 2024-12-22 15:58:55 +00:00

created store

This commit is contained in:
Erastus Amunwe 2020-10-26 23:07:25 +02:00
parent 8c1d721640
commit 9e487fac4d

35
src/store.js Normal file
View File

@ -0,0 +1,35 @@
import { createStore } from 'vuex'
export const store = createStore({
state: {
settings: {
savedTr: []
},
search: '',
},
mutations: {
add_translation (state,translation ) {
state.settings.savedTr.push(translation)
},
remove_translation (state,abbr ) {
state.settings.savedTr = state.settings.savedTr.filter(tr => tr.abbreviation !==abbr)
},
add_search(state, search){
state.search = search
}
},
actions:{
add({commit}, tr){
commit('add_translation', tr);
},
remove({commit}, abbr){
commit('remove_translation', abbr);
},
add_s({commit}, sr){
commit('add_search', sr);
},
}
})
// export default store;