view data fixes
This commit is contained in:
@@ -1,17 +1,10 @@
|
||||
// Note: No generated DTO available for UploadMedia yet
|
||||
interface UploadMediaDTO {
|
||||
success: boolean;
|
||||
mediaId?: string;
|
||||
url?: string;
|
||||
error?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Upload Media View Model
|
||||
*
|
||||
* Represents the result of a media upload operation
|
||||
*/
|
||||
import { ViewModel } from "../contracts/view-models/ViewModel";
|
||||
import type { UploadMediaViewData } from "../view-data/UploadMediaViewData";
|
||||
|
||||
export class UploadMediaViewModel extends ViewModel {
|
||||
success: boolean;
|
||||
@@ -19,11 +12,12 @@ export class UploadMediaViewModel extends ViewModel {
|
||||
url?: string;
|
||||
error?: string;
|
||||
|
||||
constructor(dto: UploadMediaDTO) {
|
||||
this.success = dto.success;
|
||||
if (dto.mediaId !== undefined) this.mediaId = dto.mediaId;
|
||||
if (dto.url !== undefined) this.url = dto.url;
|
||||
if (dto.error !== undefined) this.error = dto.error;
|
||||
constructor(data: UploadMediaViewData) {
|
||||
super();
|
||||
this.success = data.success;
|
||||
this.mediaId = data.mediaId;
|
||||
this.url = data.url;
|
||||
this.error = data.error;
|
||||
}
|
||||
|
||||
/** UI-specific: Whether upload was successful */
|
||||
@@ -35,4 +29,4 @@ export class UploadMediaViewModel extends ViewModel {
|
||||
get hasError(): boolean {
|
||||
return !!this.error;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user