Skip to content

Commit a513439

Browse files
committed
feat(frontend): set API_BASE_URL and add per-client UUID for polling
- Replace placeholder API_BASE_URL with deployment URL - Generate per-client ID with crypto.randomUUID() (myClientId) - Append clientId to GET /messages?since=... requests to support server long-poll tracking
1 parent f6635eb commit a513439

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

chat-app/frontend/script.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
1-
const API_BASE_URL = "${API_BASE_URL}";
1+
const API_BASE_URL = "https://iswanna-chat-app-backend.hosting.codeyourfuture.io";
2+
const myClientId = crypto.randomUUID();
23

34
let lastIdSeen = -1;
45

56
async function getAllMessages() {
67
try {
78
const response = await fetch(
8-
`${API_BASE_URL}/messages?since=${lastIdSeen}`,
9+
`${API_BASE_URL}/messages?since=${lastIdSeen}&clientId=${myClientId}`,
910
);
1011

1112
const data = await response.json();

0 commit comments

Comments
 (0)