Add: button to timelines with auth
This commit is contained in:
parent
7b2cef8c62
commit
a802a155c3
|
@ -24,23 +24,29 @@ import { Component, Vue } from "vue-property-decorator"
|
||||||
type Instance = string
|
type Instance = string
|
||||||
@Component
|
@Component
|
||||||
export default class Auth extends Vue {
|
export default class Auth extends Vue {
|
||||||
public instance: Instance = ''
|
public instance: Instance = ""
|
||||||
public code: string = ''
|
public code: string = ""
|
||||||
public domain: string = ''
|
public domain: string = ""
|
||||||
|
|
||||||
public get inputCode(): boolean {
|
public get inputCode(): boolean {
|
||||||
return this.instance !== ''
|
return this.instance !== ""
|
||||||
}
|
}
|
||||||
|
|
||||||
public addAccount() {
|
public addAccount() {
|
||||||
this.instance = this.domain
|
this.instance = this.domain
|
||||||
this.domain = ''
|
this.domain = ""
|
||||||
ipcRenderer.send(`new-account-setup`, this.instance)
|
ipcRenderer.send(`new-account-setup`, this.instance)
|
||||||
}
|
}
|
||||||
public authCode() {
|
public authCode() {
|
||||||
let code = this.code
|
let code = this.code
|
||||||
ipcRenderer.send(`new-account-auth`, code, this.instance)
|
ipcRenderer.send(`new-account-auth`, code, this.instance)
|
||||||
this.instance = ''
|
this.code = ""
|
||||||
|
ipcRenderer.once(
|
||||||
|
`login-complete`,
|
||||||
|
(e: Event) => {
|
||||||
|
|
||||||
|
}
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -68,19 +68,21 @@ export default class Auth {
|
||||||
autoload: true
|
autoload: true
|
||||||
})
|
})
|
||||||
let docs = {
|
let docs = {
|
||||||
|
domain: url,
|
||||||
acct: you.acct,
|
acct: you.acct,
|
||||||
avatar: you.avatar,
|
avatar: you.avatar,
|
||||||
avatarStatic: you.avatar_static,
|
avatarStatic: you.avatar_static,
|
||||||
accessToken: tokenData.accessToken
|
accessToken: tokenData.accessToken,
|
||||||
|
color: undefined
|
||||||
}
|
}
|
||||||
db.insert(docs, function(err, newDocs) {
|
db.insert(docs, function(err, newDocs) {
|
||||||
if(err){
|
if (err) {
|
||||||
event.sender.send(`error`, {
|
event.sender.send(`error`, {
|
||||||
id: "ERROR_YOU_TRY_ANOTHER_ACCOUNT",
|
id: "ERROR_YOU_TRY_ANOTHER_ACCOUNT",
|
||||||
message: "You cannot login already logined account."
|
message: "You cannot login already logined account."
|
||||||
})
|
})
|
||||||
}else{
|
} else {
|
||||||
event.sender.send(`login-complete`, newDocs)
|
event.sender.send(`login-complete`)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in New Issue
Block a user