diff --git a/src/app/update-account/update-account.component.ts b/src/app/update-account/update-account.component.ts index d7b2488..e66806a 100644 --- a/src/app/update-account/update-account.component.ts +++ b/src/app/update-account/update-account.component.ts @@ -32,8 +32,12 @@ export class UpdateAccountComponent { public get newImageUrl(): string|undefined { const value = this.imageUrlForm.controls['imageUrl'].getRawValue() + if (value === null || value === undefined) { + return undefined + } + const trimmedValue = value.trim() - return value?.trim() === '' ? undefined : value.trim() + return trimmedValue === '' ? undefined : trimmedValue } constructor( @@ -115,9 +119,12 @@ export class UpdateAccountComponent { ) } - private async isValidImageUrl(imageUrl: string|undefined): Promise { - imageUrl = imageUrl?.trim() === '' ? undefined : imageUrl.trim() - if (imageUrl === undefined) { + private async isValidImageUrl(imageUrl: string|null|undefined): Promise { + if (imageUrl === null || imageUrl === undefined) { + return true + } + imageUrl = imageUrl.trim() + if (imageUrl === '') { return true }