From a802a155c3ba2080985cd34ef999a320d3cf860f Mon Sep 17 00:00:00 2001 From: Cutls Date: Fri, 26 Apr 2019 23:37:32 +0900 Subject: [PATCH] Add: button to timelines with auth --- src/components/Preference/AccountManager.vue | 18 ++++++++++++------ src/main/Auth.ts | 10 ++++++---- 2 files changed, 18 insertions(+), 10 deletions(-) diff --git a/src/components/Preference/AccountManager.vue b/src/components/Preference/AccountManager.vue index c3aa0bb0..4a4d78ca 100644 --- a/src/components/Preference/AccountManager.vue +++ b/src/components/Preference/AccountManager.vue @@ -24,23 +24,29 @@ import { Component, Vue } from "vue-property-decorator" type Instance = string @Component export default class Auth extends Vue { - public instance: Instance = '' - public code: string = '' - public domain: string = '' + public instance: Instance = "" + public code: string = "" + public domain: string = "" public get inputCode(): boolean { - return this.instance !== '' + return this.instance !== "" } public addAccount() { this.instance = this.domain - this.domain = '' + this.domain = "" ipcRenderer.send(`new-account-setup`, this.instance) } public authCode() { let code = this.code ipcRenderer.send(`new-account-auth`, code, this.instance) - this.instance = '' + this.code = "" + ipcRenderer.once( + `login-complete`, + (e: Event) => { + + } + ); } } diff --git a/src/main/Auth.ts b/src/main/Auth.ts index 901ea596..cdfc362c 100644 --- a/src/main/Auth.ts +++ b/src/main/Auth.ts @@ -68,19 +68,21 @@ export default class Auth { autoload: true }) let docs = { + domain: url, acct: you.acct, avatar: you.avatar, avatarStatic: you.avatar_static, - accessToken: tokenData.accessToken + accessToken: tokenData.accessToken, + color: undefined } db.insert(docs, function(err, newDocs) { - if(err){ + if (err) { event.sender.send(`error`, { id: "ERROR_YOU_TRY_ANOTHER_ACCOUNT", message: "You cannot login already logined account." }) - }else{ - event.sender.send(`login-complete`, newDocs) + } else { + event.sender.send(`login-complete`) } }) })