fix: types of data center call

This commit is contained in:
DarkSky
2023-01-03 13:32:03 +08:00
committed by DarkSky
parent b105eaf9a6
commit 0110efc340
18 changed files with 111 additions and 120 deletions

View File

@@ -9,7 +9,7 @@ import { StyledSettingH2 } from '../style';
import { useState } from 'react';
import { Button } from '@/ui/button';
import Input from '@/ui/input';
import { uploadBlob, Workspace, WorkspaceType } from '@affine/datacenter';
import { getDataCenter, Workspace, WorkspaceType } from '@affine/datacenter';
import { useAppState } from '@/providers/app-state-provider';
import { WorkspaceDetails } from '@/components/workspace-slider-bar/WorkspaceSelector/SelectorPopperContent';
import { WorkspaceDelete } from './delete';
@@ -74,9 +74,11 @@ export const GeneralPage = ({
const fileChange = async (file: File) => {
setUploading(true);
const blob = new Blob([file], { type: file.type });
const blobId = await uploadBlob({ blob }).finally(() => {
setUploading(false);
});
const blobId = await getDataCenter()
.then(dc => dc.apis.uploadBlob({ blob }))
.finally(() => {
setUploading(false);
});
if (blobId) {
currentWorkspace?.meta.setAvatar(blobId);
workspaces[workspace.id]?.meta.setAvatar(blobId);