diff --git a/src/app/invite/[id]/page.tsx b/src/app/invite/[id]/page.tsx index 7a81a81..66357e4 100644 --- a/src/app/invite/[id]/page.tsx +++ b/src/app/invite/[id]/page.tsx @@ -55,16 +55,16 @@ export default function Page({ params }: any) { setIsValidLink(false); } }; - if (user && isAuthenticated) { - getTeamData(); - } - if(!user && !isAuthenticated && !teamData && !isError){ - setIsDialogOpen(true) - } - }, [user]); - + getTeamData(); + }, []); const AddUserToMember = async () => { + if (!user || !isAuthenticated) { + setErrorMsg("Unauthorized Access!"); + setIsError(true); + return; + } + if ( teamData.teamMembers?.includes(user.email) || teamData.createdBy == user.email @@ -189,20 +189,14 @@ export default function Page({ params }: any) { )} - {(!user && !isAuthenticated) && ( + {isError && isDialogOpen && ( <> - - Unauthorized Access or Invalid link!! - - -

Register or Login to your account.

-

Link may be Invalid!

-
+ {errorMsg}
Home