29 lines
678 B
TypeScript
29 lines
678 B
TypeScript
/**
|
|
* 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(data: UpdateAvatarViewData) {
|
|
super();
|
|
this.success = data.success;
|
|
this.error = data.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;
|
|
}
|
|
}
|