mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-08-06 03:49:56 +08:00
fix: types of data center call
This commit is contained in:
+3
-2
@@ -12,7 +12,7 @@ import {
|
||||
} from './WorkspaceItem';
|
||||
import { WorkspaceSetting } from '@/components/workspace-setting';
|
||||
import { useCallback, useEffect, useState } from 'react';
|
||||
import { getWorkspaceDetail, WorkspaceType } from '@affine/datacenter';
|
||||
import { getDataCenter, WorkspaceType } from '@affine/datacenter';
|
||||
import { useModal } from '@/providers/global-modal-provider';
|
||||
|
||||
export type WorkspaceDetails = Record<
|
||||
@@ -54,7 +54,8 @@ export const SelectorPopperContent = ({
|
||||
if (type === WorkspaceType.Private) {
|
||||
return { id, member_count: 1, owner: user };
|
||||
} else {
|
||||
const data = await getWorkspaceDetail({ id });
|
||||
const dc = await getDataCenter();
|
||||
const data = await dc.apis.getWorkspaceDetail({ id });
|
||||
return { id, ...data } || { id, member_count: 0, owner: user };
|
||||
}
|
||||
}
|
||||
|
||||
+8
-3
@@ -1,4 +1,4 @@
|
||||
import { createWorkspace, uploadBlob } from '@affine/datacenter';
|
||||
import { getDataCenter } from '@affine/datacenter';
|
||||
import Modal from '@/ui/modal';
|
||||
import Input from '@/ui/input';
|
||||
import {
|
||||
@@ -52,7 +52,9 @@ export const WorkspaceCreate = ({ open, onClose }: WorkspaceCreateProps) => {
|
||||
ctx.fillText(workspaceName[0], 50, 50);
|
||||
canvas.toBlob(blob => {
|
||||
if (blob) {
|
||||
const blobId = uploadBlob({ blob });
|
||||
const blobId = getDataCenter().then(dc =>
|
||||
dc.apis.uploadBlob({ blob })
|
||||
);
|
||||
resolve(blobId);
|
||||
} else {
|
||||
reject();
|
||||
@@ -69,7 +71,10 @@ export const WorkspaceCreate = ({ open, onClose }: WorkspaceCreateProps) => {
|
||||
setCreating(false);
|
||||
});
|
||||
if (blobId) {
|
||||
createWorkspace({ name: workspaceName, avatar: blobId })
|
||||
getDataCenter()
|
||||
.then(dc =>
|
||||
dc.apis.createWorkspace({ name: workspaceName, avatar: blobId })
|
||||
)
|
||||
.then(async data => {
|
||||
await refreshWorkspacesMeta();
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
|
||||
Reference in New Issue
Block a user