This commit is contained in:
syuilo 2020-09-21 10:09:17 +09:00
parent 5ed0e0e43c
commit c4a83a563d
5 changed files with 30 additions and 27 deletions

View File

@ -1,5 +1,5 @@
<template>
<x-window ref="window" :width="400" :height="450" :no-padding="true" @closed="() => { $emit('closed'); destroyDom(); }" :with-ok-button="true" :ok-button-disabled="false" @ok="ok()">
<x-window :width="400" :height="450" :no-padding="true" @close="$emit('done')" :with-ok-button="true" :ok-button-disabled="false" @ok="ok()">
<template #header>{{ $t('notificationSetting') }}</template>
<div class="vv94n3oa">
<div v-if="showGlobalToggle">
@ -49,6 +49,8 @@ export default defineComponent({
}
},
emits: ['done'],
data() {
return {
typesMap: {} as Record<typeof notificationTypes[number], boolean>,
@ -70,8 +72,7 @@ export default defineComponent({
const includingTypes = this.useGlobalSetting ? null : (Object.keys(this.typesMap) as typeof notificationTypes[number][])
.filter(type => this.typesMap[type]);
this.$emit('ok', { includingTypes });
this.$refs.window.close();
this.$emit('done', { includingTypes });
},
disableAll() {

View File

@ -1,5 +1,5 @@
<template>
<x-window ref="window" @closed="() => { $emit('closed'); destroyDom(); }">
<x-window @close="$emit('done')">
<template #header>{{ $t('login') }}</template>
<mk-signin :auto-set="autoSet" @login="onLogin"/>
</x-window>
@ -25,10 +25,11 @@ export default defineComponent({
}
},
emits: ['done'],
methods: {
onLogin(res) {
this.$emit('login', res);
this.$refs.window.close();
this.$emit('done', res);
}
}
});

View File

@ -72,6 +72,8 @@ export default defineComponent({
}
},
emits: ['login'],
data() {
return {
signing: false,
@ -95,15 +97,6 @@ export default defineComponent({
},
},
created() {
if (this.autoSet) {
this.$once('login', res => {
localStorage.setItem('i', res.i);
location.reload();
});
}
},
methods: {
onUsernameChange() {
os.api('users/show', {
@ -115,6 +108,13 @@ export default defineComponent({
});
},
onLogin(res) {
if (this.autoSet) {
localStorage.setItem('i', res.i);
location.reload();
}
},
queryKey() {
this.queryingKey = true;
return navigator.credentials.get({
@ -144,6 +144,7 @@ export default defineComponent({
});
}).then(res => {
this.$emit('login', res);
this.onLogin(res);
}).catch(err => {
if (err === null) return;
os.dialog({
@ -186,6 +187,7 @@ export default defineComponent({
token: this.user && this.user.twoFactorEnabled ? this.token : undefined
}).then(res => {
this.$emit('login', res);
this.onLogin(res);
}).catch(() => {
os.dialog({
type: 'error',

View File

@ -1,5 +1,5 @@
<template>
<x-window ref="window" :width="366" :height="506" @closed="() => { $emit('closed'); destroyDom(); }">
<x-window :width="366" :height="506" @close="$emit('done')">
<template #header>{{ $t('signup') }}</template>
<x-signup :auto-set="autoSet" @signup="onSignup"/>
</x-window>
@ -25,10 +25,11 @@ export default defineComponent({
}
},
emits: ['done'],
methods: {
onSignup(res) {
this.$emit('signup', res);
this.$refs.window.close();
this.$emit('done', res);
}
}
});

View File

@ -75,6 +75,8 @@ export default defineComponent({
}
},
emits: ['signup'],
data() {
return {
host: toUnicode(host),
@ -115,15 +117,6 @@ export default defineComponent({
}
},
created() {
if (this.autoSet) {
this.$once('signup', res => {
localStorage.setItem('i', res.i);
location.reload();
});
}
},
methods: {
onChangeUsername() {
if (this.username == '') {
@ -188,6 +181,11 @@ export default defineComponent({
password: this.password
}).then(res => {
this.$emit('signup', res);
if (this.autoSet) {
localStorage.setItem('i', res.i);
location.reload();
}
});
}).catch(() => {
this.submitting = false;