mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-07-25 14:28:51 +08:00
feat: change new data center
This commit is contained in:
+3
-3
@@ -54,9 +54,9 @@ export const SelectorPopperContent = ({
|
||||
if (type === WorkspaceType.Private) {
|
||||
return { id, member_count: 1, owner: user };
|
||||
} else {
|
||||
const dc = await getDataCenter();
|
||||
const data = await dc.apis.getWorkspaceDetail({ id });
|
||||
return { id, ...data } || { id, member_count: 0, owner: user };
|
||||
// const dc = await getDataCenter();
|
||||
// const data = await dc.apis.getWorkspaceDetail({ id });
|
||||
// return { id, ...data } || { id, member_count: 0, owner: user };
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
+21
-21
@@ -52,10 +52,10 @@ export const WorkspaceCreate = ({ open, onClose }: WorkspaceCreateProps) => {
|
||||
ctx.fillText(workspaceName[0], 50, 50);
|
||||
canvas.toBlob(blob => {
|
||||
if (blob) {
|
||||
const blobId = getDataCenter().then(dc =>
|
||||
dc.apis.uploadBlob({ blob })
|
||||
);
|
||||
resolve(blobId);
|
||||
// const blobId = getDataCenter().then(dc =>
|
||||
// dc.apis.uploadBlob({ blob })
|
||||
// );
|
||||
// resolve(blobId);
|
||||
} else {
|
||||
reject();
|
||||
}
|
||||
@@ -71,23 +71,23 @@ export const WorkspaceCreate = ({ open, onClose }: WorkspaceCreateProps) => {
|
||||
setCreating(false);
|
||||
});
|
||||
if (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
|
||||
// @ts-ignore
|
||||
router.push(`/workspace/${data.id}`);
|
||||
onClose();
|
||||
})
|
||||
.catch(err => {
|
||||
console.log(err, 'err');
|
||||
})
|
||||
.finally(() => {
|
||||
setCreating(false);
|
||||
});
|
||||
// getDataCenter()
|
||||
// .then(dc =>
|
||||
// dc.apis.createWorkspace({ name: workspaceName, avatar: blobId })
|
||||
// )
|
||||
// .then(async data => {
|
||||
// await refreshWorkspacesMeta();
|
||||
// // eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// // @ts-ignore
|
||||
// router.push(`/workspace/${data.id}`);
|
||||
// onClose();
|
||||
// })
|
||||
// .catch(err => {
|
||||
// console.log(err, 'err');
|
||||
// })
|
||||
// .finally(() => {
|
||||
// setCreating(false);
|
||||
// });
|
||||
}
|
||||
};
|
||||
return (
|
||||
|
||||
Reference in New Issue
Block a user