Skip to content

Commit 42120a2

Browse files
committed
Open chat of a user in sidebar list
1 parent c63ee0e commit 42120a2

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

app/components/random_chat_components/SidebarList.tsx

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,12 @@ const SidebarList = ({
2323
return string?.slice(0, 1).toUpperCase() + string?.slice(1, string.length);
2424
}
2525

26-
const handleRemoveFriend = () => {
26+
const handleRemoveFriend = (
27+
event: React.MouseEvent<SVGElement, MouseEvent>
28+
) => {
29+
event.stopPropagation();
2730
if (typeof window !== undefined) {
2831
const userId = localStorage.getItem("userId");
29-
console.log(userId, userData.friends);
30-
// todo
3132
fetch(
3233
`http://${IP_ADDRESS}/v1.0/voyager/user_friends/${userId}/${userData.friends}`,
3334
{
@@ -58,8 +59,8 @@ const SidebarList = ({
5859
return (
5960
<div className="flex justify-between items-center my-1 px-3 py-2 text-white bg-[#393646] hover:bg-[#4e516d] rounded">
6061
<li
61-
className="list-none font-medium text-lg"
62-
onClick={() => router.push("/voyager/random_chat/randomUserId")}
62+
className="list-none font-medium text-lg w-full"
63+
onClick={() => router.push(`/voyager/random_chat/${userData.friends}`)}
6364
>
6465
{capitaliseFirstLetter(userData.friendsName)}
6566
</li>

0 commit comments

Comments
 (0)