thedesk/src/components/Preference/AccountManager.vue

49 lines
1.2 KiB
Vue
Raw Normal View History

2019-04-25 00:52:40 +09:00
<template>
<form @submit.prevent="authCode" v-if="inputCode">
2019-04-25 14:06:36 +09:00
<BaseInputText placeholder="input code" v-model="code"/>
2019-04-25 00:52:40 +09:00
<BaseButton
type="submit"
class="primary fill"
style="--font-size:.8em;"
2019-04-25 14:06:36 +09:00
:disabled="this.code === ''"
2019-04-25 00:52:40 +09:00
>Auth</BaseButton>
</form>
<form @submit.prevent="addAccount" v-else>
2019-04-25 14:06:36 +09:00
<BaseInputText placeholder="e.g:mstdn.jp" v-model="domain"/>
2019-04-25 00:52:40 +09:00
<BaseButton
type="submit"
class="primary fill"
style="--font-size:.8em;"
2019-04-25 14:06:36 +09:00
:disabled="this.domain === ''"
2019-04-25 00:52:40 +09:00
>Login</BaseButton>
</form>
</template>
<script lang="ts">
import { ipcRenderer } from "electron"
import { Component, Vue } from "vue-property-decorator"
type Instance = string
@Component
export default class Auth extends Vue {
2019-04-25 14:06:36 +09:00
public instance: Instance = ''
public code: string = ''
public domain: string = ''
public get inputCode(): boolean {
return this.instance !== ''
2019-04-25 00:52:40 +09:00
}
2019-04-25 14:06:36 +09:00
2019-04-25 00:52:40 +09:00
public addAccount() {
2019-04-25 14:06:36 +09:00
this.instance = this.domain
this.domain = ''
ipcRenderer.send(`new-account-setup`, this.instance)
2019-04-25 00:52:40 +09:00
}
public authCode() {
let code = this.code
2019-04-25 01:04:26 +09:00
ipcRenderer.send(`new-account-auth`, code, this.instance)
2019-04-25 14:06:36 +09:00
this.instance = ''
2019-04-25 00:52:40 +09:00
}
}
</script>
2019-04-25 14:06:36 +09:00
<style scoped lang="postcss">
2019-04-25 00:52:40 +09:00
</style>