feat: support remove user & workspace avatar (#4302)

This commit is contained in:
Qi authored and GitHub committed 2023-09-14 14:35:05 +00:00
1 parent e1a330a0a6
commit 465098cc9a
40 files changed
+504 -808

No files matched your search

@@ -24,8 +24,12 @@ export function useBlockSuiteWorkspaceAvatarUrl(
fallbackData: null,
});
const setAvatar = useCallback(
async (file: File) => {
async (file: File | null) => {
assertExists(blockSuiteWorkspace);
if (!file) {
blockSuiteWorkspace.meta.setAvatar('');
return;
}
const blob = new Blob([file], { type: file.type });
const blobs = await blockSuiteWorkspace.blobs;
const blobId = await blobs.set(blob);