fix: accpet invite

This commit is contained in:
DiamondThree
2022-12-21 22:16:49 +08:00
parent e913f4ebcf
commit 030ec546b8
6 changed files with 141 additions and 68 deletions
@@ -10,7 +10,7 @@ import { toast } from '@/ui/toast';
interface LoginModalProps {
open: boolean;
onClose: () => void;
workSpaceId: string;
workspaceId: string;
}
export const debounce = <T extends (...args: any) => any>(
fn: T,
@@ -41,7 +41,7 @@ const gmailReg = /^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@gmail\.com$/;
export const InviteMembers = ({
open,
onClose,
workSpaceId,
workspaceId,
}: LoginModalProps) => {
const [canInvite, setCanInvite] = useState<boolean>(true);
const [email, setEmail] = useState<string>('');
@@ -55,7 +55,10 @@ export const InviteMembers = ({
setShowTip(false);
debounce(
() => {
getUserByEmail({ email: value }).then(data => {
getUserByEmail({
email: value,
workspaceId,
}).then(data => {
if (data?.name) {
setUserData(data);
setShowTip(false);
@@ -122,7 +125,7 @@ export const InviteMembers = ({
shape="circle"
type="primary"
onClick={() => {
inviteMember({ id: workSpaceId, email: email })
inviteMember({ id: workspaceId, email: email })
.then(() => {
onClose();
})
@@ -207,7 +207,7 @@ const MembersPage = ({ workspace }: { workspace: Workspace }) => {
onClose={() => {
setIsInviteModalShow(false);
}}
workSpaceId={workspace.id}
workspaceId={workspace.id}
open={isInviteModalShow}
></InviteMembers>
</StyledMemberButtonContainer>