Skip to content

Conversation

@Asfik-1999
Copy link

Created Card component using ShadCN, including a logout button.
Developed Avatar component with a logo.
Implemented conditional rendering to hide the Card and Avatar components on the login page.

@Asfik-1999 Asfik-1999 requested a review from bsaranga August 29, 2024 13:40
setIsCardVisible(!isCardVisible);
};

const handleLogout = async () => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't handle logout here. Remove this logic.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've updated the handleLogout function in the ProfileCard component to only make a POST request to the /auth/logout route, as the server-side route in auth/logout/route.ts now handles all the logout logic (clearing cookies and redirecting).

With this change, the client-side code no longer contains any custom logic for handling the logout process—it just calls the route, and everything else is handled server-side.

Is this the correct approach, or would you prefer that I remove the handleLogout function entirely and instead directly navigate to /auth/logout?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've removed the logout handling logic from the ProfileCard component as requested. The handleLogout function and its associated code have been removed, and the Logout button no longer performs any action within this component.

@Asfik-1999 Asfik-1999 requested a review from bsaranga August 30, 2024 16:42
@@ -0,0 +1,37 @@
'use client';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't query file path name. The common header should only be displayed if the user is authenticated. Use the session object here, and convert this to a server component. @thlurte please provide him guidance if necessary.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok,

@Asfik-1999 Asfik-1999 requested a review from bsaranga September 2, 2024 10:58
@Asfik-1999 Asfik-1999 requested a review from thlurte September 2, 2024 10:58
"@radix-ui/react-scroll-area": "^1.1.0",
"@radix-ui/react-slot": "^1.1.0",
"@shadcn/ui": "^0.0.4",
"antd": "^5.20.4",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should not be added.

"dotenv": "^16.4.5",
"dotenv-cli": "^7.4.2",
"jose": "^5.8.0",
"lib_test": "file:",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's this? Remove it, if it's unnecessary. Explain here if it's necessary.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not necessary, I will remove that.

@Asfik-1999 Asfik-1999 requested a review from bsaranga September 2, 2024 14:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants