refs #850 Replace Hashtag with typescript

This commit is contained in:
AkiraFukushima 2019-04-14 20:44:48 +09:00
parent e68002ea83
commit f71edcc889
3 changed files with 35 additions and 22 deletions

View File

@ -6,7 +6,7 @@ import Local, { LocalState } from './Contents/Local'
import Public, { PublicState } from './Contents/Public'
import Search, { SearchModuleState } from './Contents/Search'
import Lists from './Contents/Lists'
import Hashtag from './Contents/Hashtag'
import Hashtag, { HashtagModuleState } from './Contents/Hashtag'
import DirectMessages, { DirectMessagesState } from './Contents/DirectMessages'
import Mentions, { MentionsState } from './Contents/Mentions'
import { Module } from 'vuex'
@ -23,6 +23,7 @@ export interface ContentsModuleState extends ContentsState {
Local: LocalState,
Public: PublicState,
Search: SearchModuleState,
Hashtag: HashtagModuleState
}
const state = (): ContentsState => ({})

View File

@ -1,21 +0,0 @@
import { ipcRenderer } from 'electron'
import List from './Hashtag/List'
import Tag from './Hashtag/Tag'
const Hashtag = {
namespaced: true,
modules: {
List,
Tag
},
actions: {
saveTag ({ dispatch }, tag) {
ipcRenderer.once('response-save-hashtag', () => {
dispatch('TimelineSpace/SideMenu/listTags', {}, { root: true })
})
ipcRenderer.send('save-hashtag', tag)
}
}
}
export default Hashtag

View File

@ -0,0 +1,33 @@
import { ipcRenderer } from 'electron'
import List from './Hashtag/List'
import Tag from './Hashtag/Tag'
import { Module, ActionTree } from 'vuex'
import { RootState } from '@/store'
export interface HashtagState {}
export interface HashtagModuleState extends HashtagState {
}
const state = (): HashtagState => ({})
const actions: ActionTree<HashtagState, RootState> = {
saveTag: ({ dispatch }, tag: string) => {
ipcRenderer.once('response-save-hashtag', () => {
dispatch('TimelineSpace/SideMenu/listTags', {}, { root: true })
})
ipcRenderer.send('save-hashtag', tag)
}
}
const Hashtag: Module<HashtagState, RootState> = {
namespaced: true,
modules: {
List,
Tag
},
state: state,
actions: actions
}
export default Hashtag