jacobinathanialpeterson commited on
Commit
a47b44b
·
1 Parent(s): d374173

Update static/script.js

Browse files
Files changed (1) hide show
  1. static/script.js +19 -2
static/script.js CHANGED
@@ -1,3 +1,6 @@
 
 
 
1
  const DELAYTIME = 500
2
  let DATA;
3
 
@@ -9,7 +12,7 @@ function postMessage(url="https://jacobinathanialpeterson-chatbox2.hf.space/post
9
  headers: {
10
  'Content-Type': 'application/json'
11
  },
12
- body: JSON.stringify({nameInput: document.getElementById("nameInputBox").value, messageInput: document.getElementById("messageInputBox").value, roomIdInput: "123"}),
13
  signal: abortSignal
14
  })
15
  .then(response => { if (!response.ok) { throw new Error('Network response was not ok.') } return response.json() })
@@ -27,7 +30,7 @@ function getMessages(url="https://jacobinathanialpeterson-chatbox2.hf.space/mess
27
  headers: {
28
  'Content-Type': 'application/json'
29
  },
30
- body: JSON.stringify({roomIdInput: "123"}),
31
  signal: abortSignal
32
  })
33
  .then(response => { if (!response.ok) { throw new Error('Network response was not ok.') } return response.json() })
@@ -54,6 +57,20 @@ function getMessages(url="https://jacobinathanialpeterson-chatbox2.hf.space/mess
54
  .catch(error => { if (error.name === 'AbortError') { console.log('Fetch aborted:', error.message) } else { console.error('Error fetching data:', error.message) }});
55
  }
56
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
57
  let atBottom = true;
58
 
59
  function updateUI() {
 
1
+ myRoomId = "123"
2
+
3
+
4
  const DELAYTIME = 500
5
  let DATA;
6
 
 
12
  headers: {
13
  'Content-Type': 'application/json'
14
  },
15
+ body: JSON.stringify({nameInput: document.getElementById("nameInputBox").value, messageInput: document.getElementById("messageInputBox").value, roomIdInput: myRoomId}),
16
  signal: abortSignal
17
  })
18
  .then(response => { if (!response.ok) { throw new Error('Network response was not ok.') } return response.json() })
 
30
  headers: {
31
  'Content-Type': 'application/json'
32
  },
33
+ body: JSON.stringify({roomIdInput: myRoomId}),
34
  signal: abortSignal
35
  })
36
  .then(response => { if (!response.ok) { throw new Error('Network response was not ok.') } return response.json() })
 
57
  .catch(error => { if (error.name === 'AbortError') { console.log('Fetch aborted:', error.message) } else { console.error('Error fetching data:', error.message) }});
58
  }
59
 
60
+
61
+
62
+
63
+
64
+
65
+
66
+
67
+
68
+
69
+
70
+
71
+
72
+
73
+
74
  let atBottom = true;
75
 
76
  function updateUI() {