mirror of
https://github.com/KevinMidboe/seasoned.git
synced 2026-03-11 03:49:07 +00:00
Implemented store to allow torrentSearch to tell our sidebar action buttons how many results we got
This commit is contained in:
40
src/modules/torrentModule.js
Normal file
40
src/modules/torrentModule.js
Normal file
@@ -0,0 +1,40 @@
|
||||
|
||||
export default {
|
||||
namespaced: true,
|
||||
state: {
|
||||
results: [],
|
||||
resultCount: null
|
||||
},
|
||||
getters: {
|
||||
results: (state) => {
|
||||
return state.results
|
||||
},
|
||||
resultCount: (state) => {
|
||||
return state.resultCount
|
||||
}
|
||||
},
|
||||
|
||||
mutations: {
|
||||
SET_RESULTS: (state, results) => {
|
||||
state.results = results;
|
||||
},
|
||||
SET_RESULT_COUNT: (state, count) => {
|
||||
state.resultCount = count;
|
||||
},
|
||||
RESET: (state) => {
|
||||
state.results = []
|
||||
state.resultCount = null
|
||||
}
|
||||
},
|
||||
actions: {
|
||||
setResults({ commit }, results) {
|
||||
commit('SET_RESULTS', results)
|
||||
},
|
||||
setResultCount({ commit }, count) {
|
||||
commit('SET_RESULT_COUNT', count)
|
||||
},
|
||||
reset({ commit }) {
|
||||
commit('RESET')
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user