view data fixes
This commit is contained in:
@@ -1,23 +1,19 @@
|
||||
// Note: No generated DTO available for UpdateAvatar yet
|
||||
interface UpdateAvatarDTO {
|
||||
success: boolean;
|
||||
error?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Update Avatar View Model
|
||||
*
|
||||
* Represents the result of an avatar update operation
|
||||
*/
|
||||
import { ViewModel } from "../contracts/view-models/ViewModel";
|
||||
import type { UpdateAvatarViewData } from "../view-data/UpdateAvatarViewData";
|
||||
|
||||
export class UpdateAvatarViewModel extends ViewModel {
|
||||
success: boolean;
|
||||
error?: string;
|
||||
|
||||
constructor(dto: UpdateAvatarDTO) {
|
||||
this.success = dto.success;
|
||||
if (dto.error !== undefined) this.error = dto.error;
|
||||
constructor(data: UpdateAvatarViewData) {
|
||||
super();
|
||||
this.success = data.success;
|
||||
this.error = data.error;
|
||||
}
|
||||
|
||||
/** UI-specific: Whether update was successful */
|
||||
@@ -29,4 +25,4 @@ export class UpdateAvatarViewModel extends ViewModel {
|
||||
get hasError(): boolean {
|
||||
return !!this.error;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user