From 3921d7f7fedc9b3948ffe81a45752b88cd7203d5 Mon Sep 17 00:00:00 2001
From: AkiraFukushima
Date: Sun, 14 Apr 2019 17:37:50 +0900
Subject: [PATCH] refs #850 Replace Search with typescript
---
.../store/TimelineSpace/Contents/Search.js | 19 ----------
.../store/TimelineSpace/Contents/Search.ts | 35 +++++++++++++++++++
2 files changed, 35 insertions(+), 19 deletions(-)
delete mode 100644 src/renderer/store/TimelineSpace/Contents/Search.js
create mode 100644 src/renderer/store/TimelineSpace/Contents/Search.ts
diff --git a/src/renderer/store/TimelineSpace/Contents/Search.js b/src/renderer/store/TimelineSpace/Contents/Search.js
deleted file mode 100644
index 9bead2c5..00000000
--- a/src/renderer/store/TimelineSpace/Contents/Search.js
+++ /dev/null
@@ -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
diff --git a/src/renderer/store/TimelineSpace/Contents/Search.ts b/src/renderer/store/TimelineSpace/Contents/Search.ts
new file mode 100644
index 00000000..228f5da0
--- /dev/null
+++ b/src/renderer/store/TimelineSpace/Contents/Search.ts
@@ -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 = {
+ [MUTATION_TYPES.CHANGE_LOADING]: (state, loading: boolean) => {
+ state.loading = loading
+ }
+}
+
+const Search: Module = {
+ namespaced: true,
+ modules: { Account, Tag, Toots },
+ state: state,
+ mutations: mutations
+}
+
+export default Search