enhance(frontend): 定義されていないエラーも表示できるように (MisskeyIO#738)
+登録時のAPIエラーを表示できるように
This commit is contained in:
parent
c82bf7583a
commit
69f31e6246
3 changed files with 84 additions and 74 deletions
|
@ -189,7 +189,7 @@ async function onSubmit(): Promise<void> {
|
|||
submitting.value = true;
|
||||
|
||||
try {
|
||||
await misskeyApi('signup', {
|
||||
await os.apiWithDialog('signup', {
|
||||
username: username.value,
|
||||
password: password.value.password,
|
||||
emailAddress: email.value,
|
||||
|
@ -198,35 +198,27 @@ async function onSubmit(): Promise<void> {
|
|||
'm-captcha-response': mCaptchaResponse.value,
|
||||
'g-recaptcha-response': reCaptchaResponse.value,
|
||||
'turnstile-response': turnstileResponse.value,
|
||||
});
|
||||
if (instance.emailRequiredForSignup) {
|
||||
os.alert({
|
||||
type: 'success',
|
||||
title: i18n.ts._signup.almostThere,
|
||||
text: i18n.tsx._signup.emailSent({ email: email.value }),
|
||||
});
|
||||
emit('signupEmailPending');
|
||||
} else {
|
||||
const res = await misskeyApi('signin', {
|
||||
username: username.value,
|
||||
password: password.value.password,
|
||||
});
|
||||
emit('signup', res);
|
||||
}, undefined, (res) => {
|
||||
if (instance.emailRequiredForSignup) {
|
||||
os.alert({
|
||||
type: 'success',
|
||||
title: i18n.ts._signup.almostThere,
|
||||
text: i18n.tsx._signup.emailSent({ email: email.value }),
|
||||
});
|
||||
emit('signupEmailPending');
|
||||
} else {
|
||||
emit('signup', { id: res.id, i: res.token });
|
||||
|
||||
if (props.autoSet) {
|
||||
return login(res.i);
|
||||
if (props.autoSet) {
|
||||
login(res.token);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
} catch {
|
||||
submitting.value = false;
|
||||
hcaptcha.value?.reset?.();
|
||||
recaptcha.value?.reset?.();
|
||||
turnstile.value?.reset?.();
|
||||
|
||||
os.alert({
|
||||
type: 'error',
|
||||
text: i18n.ts.somethingHappened,
|
||||
});
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue