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
@@ -4,7 +4,7 @@ import { Modal, ModalWrapper, ModalCloseButton } from '@/ui/modal';
import { Button } from '@/ui/button';
import Input from '@/ui/input';
import { useState } from 'react';
import { inviteMember, getUserByEmail } from '@affine/datacenter';
import { getDataCenter } from '@affine/datacenter';
import { Avatar } from '@mui/material';
interface LoginModalProps {
open: boolean;
@@ -60,15 +60,19 @@ export const InviteMembers = ({
setShowTip(false);
debounce(
() => {
getUserByEmail({
email: value,
workspace_id: workspaceId,
}).then(data => {
if (data?.name) {
setUserData(data);
setShowTip(false);
}
});
getDataCenter()
.then(dc =>
dc.apis.getUserByEmail({
email: value,
workspace_id: workspaceId,
})
)
.then(data => {
if (data?.name) {
setUserData(data);
setShowTip(false);
}
});
},
300,
true
@@ -130,7 +134,8 @@ export const InviteMembers = ({
shape="circle"
type="primary"
onClick={() => {
inviteMember({ id: workspaceId, email: email })
getDataCenter()
.then(dc => dc.apis.inviteMember({ id: workspaceId, email }))
.then(() => {
onClose();
onInviteSuccess && onInviteSuccess();