Skip to content

Commit a07f1c1

Browse files
MMwandighatuxpiper
authored andcommitted
setting media fields value as an array, enhancing photo validation to support arrays (#1523)
1 parent 8670c16 commit a07f1c1

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

apps/mobile-mzima-client/src/app/core/validators/photo-required.validator.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ export function PhotoRequiredValidator(): ValidatorFn {
44
return (control: AbstractControl): { [key: string]: any } | null => {
55
const value = control.value;
66

7-
if (value && value.photo) {
7+
if (value && (Array.isArray(value) ? value.length > 0 : value.photo)) {
88
return null;
99
} else {
1010
return { photoRequired: true };

apps/mobile-mzima-client/src/app/post/helpers/upload-file-progress.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ export class UploadFileProgressHelper {
3131
const event: any = await lastValueFrom(uploadProgress);
3232

3333
if (event?.body?.result?.id) {
34-
field.value = { value: event.body.result.id };
34+
field.value = { value: [event.body.result.id] };
3535
}
3636

3737
Filesystem.deleteFile({

0 commit comments

Comments
 (0)