mirror of
https://github.com/getbible/app.git
synced 2024-12-22 15:58:55 +00:00
created store
This commit is contained in:
parent
8c1d721640
commit
9e487fac4d
35
src/store.js
Normal file
35
src/store.js
Normal 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;
|
Loading…
Reference in New Issue
Block a user