fix(client): アカウント作成フォームでエラーが出る問題を修正

This commit is contained in:
syuilo 2022-06-24 21:19:38 +09:00
parent bf4726f91d
commit 905d8625f8

View file

@ -67,12 +67,12 @@
<script lang="ts"> <script lang="ts">
import { defineComponent, defineAsyncComponent } from 'vue'; import { defineComponent, defineAsyncComponent } from 'vue';
const getPasswordStrength = await import('syuilo-password-strength'); import getPasswordStrength from 'syuilo-password-strength';
import { toUnicode } from 'punycode/'; import { toUnicode } from 'punycode/';
import { host, url } from '@/config';
import MkButton from './ui/button.vue'; import MkButton from './ui/button.vue';
import MkInput from './form/input.vue'; import MkInput from './form/input.vue';
import MkSwitch from './form/switch.vue'; import MkSwitch from './form/switch.vue';
import { host, url } from '@/config';
import * as os from '@/os'; import * as os from '@/os';
import { login } from '@/account'; import { login } from '@/account';
@ -89,7 +89,7 @@ export default defineComponent({
type: Boolean, type: Boolean,
required: false, required: false,
default: false, default: false,
} },
}, },
emits: ['signup'], emits: ['signup'],
@ -132,7 +132,7 @@ export default defineComponent({
this.usernameState !== 'invalid-format' && this.usernameState !== 'invalid-format' &&
this.usernameState !== 'min-range' && this.usernameState !== 'min-range' &&
this.usernameState !== 'max-range'); this.usernameState !== 'max-range');
} },
}, },
methods: { methods: {
@ -156,7 +156,7 @@ export default defineComponent({
this.usernameState = 'wait'; this.usernameState = 'wait';
os.api('username/available', { os.api('username/available', {
username: this.username username: this.username,
}).then(result => { }).then(result => {
this.usernameState = result.available ? 'ok' : 'unavailable'; this.usernameState = result.available ? 'ok' : 'unavailable';
}).catch(err => { }).catch(err => {
@ -173,7 +173,7 @@ export default defineComponent({
this.emailState = 'wait'; this.emailState = 'wait';
os.api('email-address/available', { os.api('email-address/available', {
emailAddress: this.email emailAddress: this.email,
}).then(result => { }).then(result => {
this.emailState = result.available ? 'ok' : this.emailState = result.available ? 'ok' :
result.reason === 'used' ? 'unavailable:used' : result.reason === 'used' ? 'unavailable:used' :
@ -228,7 +228,7 @@ export default defineComponent({
} else { } else {
os.api('signin', { os.api('signin', {
username: this.username, username: this.username,
password: this.password password: this.password,
}).then(res => { }).then(res => {
this.$emit('signup', res); this.$emit('signup', res);
@ -244,11 +244,11 @@ export default defineComponent({
os.alert({ os.alert({
type: 'error', type: 'error',
text: this.$ts.somethingHappened text: this.$ts.somethingHappened,
}); });
}); });
} },
} },
}); });
</script> </script>