fix(email-checker): success can have no suggestions
This commit is contained in:
parent
69e1b1be41
commit
406516a346
1 changed files with 2 additions and 2 deletions
|
@ -4,7 +4,7 @@ import { ApplicationController } from './application_controller';
|
||||||
type CheckEmailResponse =
|
type CheckEmailResponse =
|
||||||
| {
|
| {
|
||||||
success: true;
|
success: true;
|
||||||
suggestions: string[];
|
suggestions?: string[];
|
||||||
}
|
}
|
||||||
| { success: false };
|
| { success: false };
|
||||||
|
|
||||||
|
@ -38,7 +38,7 @@ export class EmailInputController extends ApplicationController {
|
||||||
.catch(() => null);
|
.catch(() => null);
|
||||||
|
|
||||||
if (data?.success) {
|
if (data?.success) {
|
||||||
const suggestion = data.suggestions.at(0);
|
const suggestion = data.suggestions?.at(0);
|
||||||
if (suggestion) {
|
if (suggestion) {
|
||||||
this.suggestionTarget.innerHTML = suggestion;
|
this.suggestionTarget.innerHTML = suggestion;
|
||||||
show(this.ariaRegionTarget);
|
show(this.ariaRegionTarget);
|
||||||
|
|
Loading…
Reference in a new issue