Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: authorized access #297

Merged
merged 1 commit into from
Jun 15, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 11 additions & 17 deletions src/app/invite/[id]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -189,20 +189,14 @@ export default function Page({ params }: any) {
</AlertDialogFooter>
</>
)}
{(!user && !isAuthenticated) && (
{isError && isDialogOpen && (
<>
<AlertDialogHeader>
<AlertDialogTitle>
Unauthorized Access or Invalid link!!
</AlertDialogTitle>
<AlertDialogDescription className="w-full">
<p>Register or Login to your account.</p>
<p>Link may be Invalid!</p>
</AlertDialogDescription>
<AlertDialogTitle>{errorMsg}</AlertDialogTitle>
</AlertDialogHeader>
<AlertDialogFooter>
<Link
className="bg-primary p-2 rounded-lg px-3 text-secondary"
className="bg-primary text-white p-2 rounded-lg px-3 text-secondary"
href={"/"}
>
Home
Expand Down
Loading