From 372bfaceda5bf694bf33986b5a64a56e5787104c Mon Sep 17 00:00:00 2001 From: syuilo Date: Sun, 29 Apr 2018 17:17:15 +0900 Subject: リファクタリングなど MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/client/app/init.ts | 28 ++++++---------------------- 1 file changed, 6 insertions(+), 22 deletions(-) (limited to 'src/client/app/init.ts') diff --git a/src/client/app/init.ts b/src/client/app/init.ts index 26f5328d7d..6f7ce02607 100644 --- a/src/client/app/init.ts +++ b/src/client/app/init.ts @@ -3,7 +3,7 @@ */ import Vue from 'vue'; -import Vuex from 'vuex'; +import Vuex, { mapState } from 'vuex'; import VueRouter from 'vue-router'; import VModal from 'vue-js-modal'; import * as TreeView from 'vue-json-tree-view'; @@ -41,17 +41,6 @@ require('./common/views/widgets'); // Register global filters require('./common/views/filters'); -const store = new Vuex.Store({ - state: { - uiHeaderHeight: 0 - }, - mutations: { - setUiHeaderHeight(state, height) { - state.uiHeaderHeight = height; - } - } -}); - Vue.mixin({ destroyed(this: any) { if (this.$el.parentNode) { @@ -159,20 +148,15 @@ export default (callback: (launch: (router: VueRouter, api?: (os: MiOS) => API) api: os.api, apis: os.apis }; - } + }, + computed: mapState({ + clientSettings: state => state.settings.data + }) }); const app = new Vue({ - store, + store: os.store, router, - created() { - this.$watch('os.i', i => { - // キャッシュ更新 - localStorage.setItem('me', JSON.stringify(i)); - }, { - deep: true - }); - }, render: createEl => createEl(App) }); -- cgit v1.2.3-freya