-
Notifications
You must be signed in to change notification settings - Fork 3
86b1vx0v2: Add Card and Avatar Components with Conditional Rendering for Login Page #25
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
base: development
Are you sure you want to change the base?
Conversation
…Logout), and app title/logo.
… on the login page.
| setIsCardVisible(!isCardVisible); | ||
| }; | ||
|
|
||
| const handleLogout = async () => { |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
| @@ -0,0 +1,37 @@ | |||
| 'use client'; | |||
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok,
server/package.json
Outdated
| "@radix-ui/react-scroll-area": "^1.1.0", | ||
| "@radix-ui/react-slot": "^1.1.0", | ||
| "@shadcn/ui": "^0.0.4", | ||
| "antd": "^5.20.4", |
There was a problem hiding this comment.
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.
server/package.json
Outdated
| "dotenv": "^16.4.5", | ||
| "dotenv-cli": "^7.4.2", | ||
| "jose": "^5.8.0", | ||
| "lib_test": "file:", |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
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.