refs #850 Replace Search with typescript
This commit is contained in:
parent
c60192ba18
commit
3921d7f7fe
|
@ -1,19 +0,0 @@
|
||||||
import Account from './Search/Account'
|
|
||||||
import Tag from './Search/Tag'
|
|
||||||
import Toots from './Search/Toots'
|
|
||||||
|
|
||||||
const Search = {
|
|
||||||
namespaced: true,
|
|
||||||
modules: { Account, Tag, Toots },
|
|
||||||
state: {
|
|
||||||
loading: false
|
|
||||||
},
|
|
||||||
mutations: {
|
|
||||||
changeLoading (state, loading) {
|
|
||||||
state.loading = loading
|
|
||||||
}
|
|
||||||
},
|
|
||||||
actions: {}
|
|
||||||
}
|
|
||||||
|
|
||||||
export default Search
|
|
|
@ -0,0 +1,35 @@
|
||||||
|
import Account from './Search/Account'
|
||||||
|
import Tag from './Search/Tag'
|
||||||
|
import Toots from './Search/Toots'
|
||||||
|
import { Module, MutationTree } from 'vuex'
|
||||||
|
import { RootState } from '@/store'
|
||||||
|
|
||||||
|
export interface SearchState {
|
||||||
|
loading: boolean
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface SearchModuleState extends SearchState {
|
||||||
|
}
|
||||||
|
|
||||||
|
const state = (): SearchState => ({
|
||||||
|
loading: false
|
||||||
|
})
|
||||||
|
|
||||||
|
export const MUTATION_TYPES = {
|
||||||
|
CHANGE_LOADING: 'changeLoading'
|
||||||
|
}
|
||||||
|
|
||||||
|
const mutations: MutationTree<SearchState> = {
|
||||||
|
[MUTATION_TYPES.CHANGE_LOADING]: (state, loading: boolean) => {
|
||||||
|
state.loading = loading
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const Search: Module<SearchState, RootState> = {
|
||||||
|
namespaced: true,
|
||||||
|
modules: { Account, Tag, Toots },
|
||||||
|
state: state,
|
||||||
|
mutations: mutations
|
||||||
|
}
|
||||||
|
|
||||||
|
export default Search
|
Loading…
Reference in New Issue