-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
287c3ee
commit 5f6a811
Showing
11 changed files
with
132 additions
and
37 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import Cookies from 'js-cookie'; | ||
import { useRouter } from 'next/navigation'; | ||
|
||
const useLogin = () => { | ||
const router = useRouter(); | ||
|
||
const login = async (username) => { | ||
const response = await fetch('http://localhost:8081/auth/login', { | ||
method: 'POST', | ||
headers: { | ||
'Content-Type': 'application/json', | ||
}, | ||
body: JSON.stringify({ username }), | ||
}); | ||
const user = await response.json(); | ||
|
||
if (user) { | ||
Cookies.set('access_token', JSON.stringify(user.token), { expires: 1 }); | ||
router.push('/chat'); | ||
} | ||
}; | ||
|
||
return { login }; | ||
}; | ||
|
||
export default useLogin; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
'use client'; | ||
|
||
import { useRouter } from 'next/navigation'; | ||
|
||
const Profile = () => { | ||
const router = useRouter(); | ||
|
||
return ( | ||
<div className="min-h-screen bg-gray-900 flex flex-col items-center p-6 relative"> | ||
<div className="absolute top-4 left-4"> | ||
<button | ||
onClick={() => router.back()} | ||
className="bg-gray-700 hover:bg-gray-600 text-white font-bold py-2 px-4 rounded" | ||
> | ||
Back | ||
</button> | ||
</div> | ||
<div className="bg-gray-800 shadow-md rounded-lg overflow-hidden w-full max-w-md relative"> | ||
<div className="absolute top-4 right-4"> | ||
<button | ||
onClick={() => {}} | ||
className="bg-blue-500 hover:bg-blue-400 text-white font-bold py-2 px-4 rounded" | ||
> | ||
Edit | ||
</button> | ||
</div> | ||
<div className="bg-gray-700 h-32 flex justify-center items-center"> | ||
<img | ||
src="https://via.placeholder.com/100" | ||
alt="Profile" | ||
className="w-24 h-24 rounded-full border-4 border-gray-800 -mt-12" | ||
/> | ||
</div> | ||
<div className="p-6"> | ||
<h1 className="text-xl font-semibold text-white">John Doe</h1> | ||
<p className="text-gray-400">@johndoe</p> | ||
<p className="mt-4 text-gray-300"> | ||
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed do | ||
eiusmod tempor incididunt ut labore et dolore magna aliqua. | ||
</p> | ||
<div className="mt-6"> | ||
<h2 className="text-lg font-semibold text-white">Details</h2> | ||
<ul className="mt-2 text-gray-300"> | ||
<li>Email: [email protected]</li> | ||
<li>Location: New York, USA</li> | ||
<li>Member since: January 2020</li> | ||
</ul> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
); | ||
}; | ||
|
||
export default Profile; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters