mirror of
https://github.com/KevinMidboe/seasoned.git
synced 2026-05-14 18:15:41 +00:00
46 lines
1.0 KiB
TypeScript
46 lines
1.0 KiB
TypeScript
import type ITorrent from "../interfaces/ITorrent";
|
|
import type IStateTorrent from "../interfaces/IStateTorrent";
|
|
|
|
const state: IStateTorrent = {
|
|
results: [],
|
|
resultCount: null
|
|
};
|
|
|
|
/* eslint-disable @typescript-eslint/no-shadow */
|
|
export default {
|
|
namespaced: true,
|
|
state,
|
|
getters: {
|
|
results: (state: IStateTorrent) => {
|
|
return state.results;
|
|
},
|
|
resultCount: (state: IStateTorrent) => {
|
|
return state.resultCount;
|
|
}
|
|
},
|
|
|
|
mutations: {
|
|
SET_RESULTS: (state: IStateTorrent, results: Array<ITorrent>) => {
|
|
state.results = results;
|
|
},
|
|
SET_RESULT_COUNT: (state: IStateTorrent, count: number) => {
|
|
state.resultCount = count;
|
|
},
|
|
RESET: (state: IStateTorrent) => {
|
|
state.results = [];
|
|
state.resultCount = null;
|
|
}
|
|
},
|
|
actions: {
|
|
setResults({ commit }, results: Array<ITorrent>) {
|
|
commit("SET_RESULTS", results);
|
|
},
|
|
setResultCount({ commit }, count: number) {
|
|
commit("SET_RESULT_COUNT", count);
|
|
},
|
|
reset({ commit }) {
|
|
commit("RESET");
|
|
}
|
|
}
|
|
};
|