view models
This commit is contained in:
@@ -1,9 +1,30 @@
|
||||
// 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
|
||||
*/
|
||||
export interface UpdateAvatarViewModel {
|
||||
export class UpdateAvatarViewModel {
|
||||
success: boolean;
|
||||
error?: string;
|
||||
|
||||
constructor(dto: UpdateAvatarDTO) {
|
||||
this.success = dto.success;
|
||||
if (dto.error !== undefined) this.error = dto.error;
|
||||
}
|
||||
|
||||
/** UI-specific: Whether update was successful */
|
||||
get isSuccessful(): boolean {
|
||||
return this.success;
|
||||
}
|
||||
|
||||
/** UI-specific: Whether there was an error */
|
||||
get hasError(): boolean {
|
||||
return !!this.error;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user