Skip to content

Commit

Permalink
feat: chatapp-logoutbutton
Browse files Browse the repository at this point in the history
  • Loading branch information
arnb-smnta committed May 10, 2024
1 parent adefc21 commit eba38f7
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import ChatItem from "../components/chat/ChatItem";
import MessageItem from "../components/chat/MessageItem";
import Typing from "../components/chat/Typing";
import Input from "../components/Input";
import { useAuth } from "../context/AuthContext";
import { AuthContext, useAuth } from "../context/AuthContext";
import { useSocket } from "../context/SocketContext";
import {
ChatListItemInterface,
Expand All @@ -41,6 +41,11 @@ const MESSAGE_DELETE_EVENT = "messageDeleted";
// const SOCKET_ERROR_EVENT = "socketError";

const ChatPage = () => {
//logout function

const { logout } = useAuth();
const handlelogout = async () => await logout();

// Import the 'useAuth' and 'useSocket' hooks from their respective contexts
const { user } = useAuth();
const { socket } = useSocket();
Expand Down Expand Up @@ -426,6 +431,14 @@ const ChatPage = () => {
<div className="w-full justify-between items-stretch h-screen flex flex-shrink-0">
<div className="w-1/3 relative ring-white overflow-y-auto px-4">
<div className="z-10 w-full sticky top-0 bg-dark py-4 flex justify-between items-center gap-4">
<button
type="button"
className="focus:outline-none text-white bg-purple-700 hover:bg-purple-800 focus:ring-4 focus:ring-purple-300 font-medium rounded-xl text-sm px-5 py-4 mb-2 dark:bg-purple-600 dark:hover:bg-purple-700 dark:focus:ring-purple-900 flex-shrink-0"
onClick={handlelogout}
>
Log Out
</button>

<Input
placeholder="Search user or group..."
value={localSearchQuery}
Expand Down
11 changes: 6 additions & 5 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2726,7 +2726,7 @@ [email protected]:
resolved "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz"
integrity sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow==

ejs@^3.1.10, ejs@^3.1.6:
ejs@^3.1.6:
version "3.1.10"
resolved "https://registry.npmjs.org/ejs/-/ejs-3.1.10.tgz#69ab8358b14e896f80cc39e62087b88500c3ac3b"
integrity sha512-UeJmFfOrAQS8OJWPZ4qtgHyWExa088/MtK5UEyoJGFH67cDEXkZSviOiKRCZ4Xij0zxI3JECgYs3oKx+AizQBA==
Expand Down Expand Up @@ -3106,14 +3106,15 @@ form-data@~2.3.2:
combined-stream "^1.0.6"
mime-types "^2.1.12"

formidable@^2.1.2, formidable@^3.5.1:
version "3.5.1"
resolved "https://registry.npmjs.org/formidable/-/formidable-3.5.1.tgz#9360a23a656f261207868b1484624c4c8d06ee1a"
integrity sha512-WJWKelbRHN41m5dumb0/k8TeAx7Id/y3a+Z7QfhxP/htI9Js5zYaEDtG8uMgG0vM0lOlqnmjE99/kfpOYi/0Og==
formidable@^2.1.2:
version "2.1.2"
resolved "https://registry.yarnpkg.com/formidable/-/formidable-2.1.2.tgz#fa973a2bec150e4ce7cac15589d7a25fc30ebd89"
integrity sha512-CM3GuJ57US06mlpQ47YcunuUZ9jpm8Vx+P2CGt2j7HpgkKZO/DJYQ0Bobim8G6PFQmK5lOqOOdUXboU+h73A4g==
dependencies:
dezalgo "^1.0.4"
hexoid "^1.0.0"
once "^1.4.0"
qs "^6.11.0"

[email protected]:
version "0.2.0"
Expand Down

0 comments on commit eba38f7

Please sign in to comment.