From a8bfb2920bce8aae4fe9db5a2ad8fa24c914a11d Mon Sep 17 00:00:00 2001 From: kPherox Date: Sat, 11 May 2019 16:14:02 +0900 Subject: [PATCH] Change to pass timeline doc to main when startup --- src/main/Timeline.ts | 4 ++-- src/views/App.vue | 14 +++++++++++--- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/src/main/Timeline.ts b/src/main/Timeline.ts index 9965afc3..6b2e51a4 100644 --- a/src/main/Timeline.ts +++ b/src/main/Timeline.ts @@ -36,7 +36,7 @@ export default class Timeline { private static async onAddTimeline(event: Event, name: string, type: string) { if (!(type in this.endpoints) && type !== 'no-auth') { - event.sender.send(`add-timeline`, {}, new Error("Not supported type")) + event.sender.send(`add-timeline`, undefined, new Error("Not supported type")) return } @@ -54,7 +54,7 @@ export default class Timeline { if (err) { let error = new Error("You cannot login already logined account.") error.name = "ERROR_YOU_TRY_ANOTHER_ACCOUNT" - event.sender.send(`add-timeline`, {}, error) + event.sender.send(`add-timeline`, undefined, error) } else { event.sender.send(`add-timeline`, newDocs) } diff --git a/src/views/App.vue b/src/views/App.vue index 6913e782..4ed982cc 100644 --- a/src/views/App.vue +++ b/src/views/App.vue @@ -1,7 +1,7 @@ @@ -12,6 +12,12 @@ import { Component, Vue } from 'vue-property-decorator' import Main from '@/components/Main.vue' import Welcome from '@/components/Welcome.vue' +interface TimelineDoc { + _id: string + name: string + type: string +} + @Component({ components: { Main, @@ -22,6 +28,7 @@ export default class App extends Vue { public isDarkMode: boolean = false public isStartup: boolean = true public fontSize: string = '16px' + public initTimeline?: TimelineDoc public get styles(): { [key: string]: string } { return { @@ -40,11 +47,12 @@ export default class App extends Vue { ipcRenderer.on('change-color-theme', () => this.isDarkMode = ipcRenderer.sendSync('dark-theme')) // TODO: アカウントか公開TLの追加を確認する。初回起動時のみ if (this.isStartup) { - ipcRenderer.once('add-timeline', (_e: Event, _tl: Object, error?: Error) => { - if (error) { + ipcRenderer.once('add-timeline', (_e: Event, tl?: TimelineDoc, error?: Error) => { + if (error === undefined || tl === undefined) { console.error(error) return } + this.initTimeline = tl this.isStartup = false }) }