refs #850 Replace Search with typescript

This commit is contained in:
AkiraFukushima 2019-04-14 17:37:50 +09:00
parent c60192ba18
commit 3921d7f7fe
2 changed files with 35 additions and 19 deletions

View File

@ -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

View File

@ -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