Skip to content

Commit

Permalink
Merge pull request #6 from stephan-rz/development
Browse files Browse the repository at this point in the history
realtime issue fixed
  • Loading branch information
stephan-rz authored May 19, 2024
2 parents 0818638 + bcac70d commit 7399220
Show file tree
Hide file tree
Showing 5 changed files with 2 additions and 25 deletions.
3 changes: 0 additions & 3 deletions src/app/api/messages/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ export async function POST(
}
});


await pusherServer.trigger(conversationId, 'messages:new', newMessage);

const lastMessage = updatedConversation.messages[updatedConversation.messages.length - 1];
Expand All @@ -73,8 +72,6 @@ export async function POST(
})
})



return NextResponse.json(newMessage)
} catch (error) {
console.log(error, 'ERROR_MESSAGES');
Expand Down
19 changes: 0 additions & 19 deletions src/app/api/test/route.ts

This file was deleted.

2 changes: 1 addition & 1 deletion src/components/conversations/chat-body.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ const ChatBody = ({ initialMessages }: ChatBodyProps) => {
}, [conversationId]);

useEffect(() => {
pusherClient.subscribe(conversationId[0]);
pusherClient.subscribe(conversationId as string);
bottomRef?.current?.scrollIntoView();

const messageHandler = (message: FullMessageType) => {
Expand Down
2 changes: 1 addition & 1 deletion src/lib/pusher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import PusherClient from 'pusher-js';
export const pusherServer = new PusherServer({
appId: process.env.PUSHER_APP_ID!,
key: process.env.NEXT_PUBLIC_PUSHER_APP_KEY!,
secret: process.env.PUSHER_APP_SECRET!,
secret: process.env.PUSHER_SECRET!,
cluster: 'ap2',
useTLS: true,

Expand Down
1 change: 0 additions & 1 deletion src/middleware.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import NextAuth from "next-auth";
import authConfig from "./auth.config";

import { DEFAULT_LOGIN_REDIRECT, apiAuthPrefix, authRoutes, publicRoutes } from "@/routes"
import { getUserData } from "./data/session";

const { auth } = NextAuth(authConfig)
//@ts-ignore
Expand Down

0 comments on commit 7399220

Please sign in to comment.