Skip to content
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

Revert stuff #126

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions front-end/src/chat/chatwindow.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,13 +88,13 @@ function ChatWindowComponent({ currentUserId }) {

useEffect(() => {
async function fetchMessages() {
try {
const response = await fetch(`http://localhost:3000/api/messages/${conversationId}`,
{
headers: {
userId: currentUserId,
},
});

console.log(token)

const response = await fetch(`${process.env.REACT_APP_API_URL}/api/messages/${conversationId}`, {
headers: {
userId: currentUserId// Include the JWT token in the headers
},
const data = await response.json();
setMessages(data.messages);
} catch (error) {
Expand All @@ -114,7 +114,7 @@ function ChatWindowComponent({ currentUserId }) {
async function handleSubmit(e) {
e.preventDefault();
try {
const response = await fetch(`http://localhost:3000/api/messages/${conversationId}`, {
const response = await fetch(`${process.env.REACT_APP_API_URL}/api/messages/${conversationId}`, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
Expand Down