add methods upload and delete avatar methods to context

This commit is contained in:
Mads Rasmussen
2023-11-08 12:59:10 +01:00
parent 85b5728b72
commit 5e9f43777f

View File

@@ -89,6 +89,18 @@ export class UmbUserWorkspaceContext
}
}
async uploadAvatar(file: File) {
const id = this.getEntityId();
if (!id) throw new Error('Id is missing');
await this.repository.uploadAvatar(id, file);
}
async removeAvatar() {
const id = this.getEntityId();
if (!id) throw new Error('Id is missing');
await this.repository.deleteAvatar(id);
}
destroy(): void {
this.#data.complete();
}