DevouringStars commited on
Commit
3536abf
·
1 Parent(s): 942f7d6

fix: Use relative URLs for API calls in production

Browse files
Files changed (1) hide show
  1. static/script.js +3 -3
static/script.js CHANGED
@@ -56,7 +56,7 @@ document.addEventListener("DOMContentLoaded", () => {
56
  }
57
 
58
  try {
59
- const response = await fetch("http://localhost:5000/api/conversations", {
60
  method: "DELETE",
61
  headers: { "Content-Type": "application/json" },
62
  body: JSON.stringify({ userId: currentUserId }) // Send userID to be deleted
@@ -127,7 +127,7 @@ document.addEventListener("DOMContentLoaded", () => {
127
  chatLog.scrollTop = chatLog.scrollHeight;
128
 
129
  try {
130
- const response = await fetch("http://localhost:5000/api/chat", {
131
  method: "POST",
132
  headers: { "Content-Type": "application/json" },
133
  body: JSON.stringify({
@@ -233,7 +233,7 @@ document.addEventListener("DOMContentLoaded", () => {
233
  async function initializeApp() {
234
  if (!currentUserId) return;
235
  try {
236
- const response = await fetch(`http://localhost:5000/api/conversations?userId=${currentUserId}`);
237
  if (!response.ok) {
238
  throw new Error("Failed to load history");
239
  }
 
56
  }
57
 
58
  try {
59
+ const response = await fetch("/api/conversations", {
60
  method: "DELETE",
61
  headers: { "Content-Type": "application/json" },
62
  body: JSON.stringify({ userId: currentUserId }) // Send userID to be deleted
 
127
  chatLog.scrollTop = chatLog.scrollHeight;
128
 
129
  try {
130
+ const response = await fetch("/api/chat", {
131
  method: "POST",
132
  headers: { "Content-Type": "application/json" },
133
  body: JSON.stringify({
 
233
  async function initializeApp() {
234
  if (!currentUserId) return;
235
  try {
236
+ const response = await fetch(`/api/conversations?userId=${currentUserId}`);
237
  if (!response.ok) {
238
  throw new Error("Failed to load history");
239
  }