From 917a6fdce6c5274816743d737bf429082b8648e8 Mon Sep 17 00:00:00 2001 From: SebastienCozeDev Date: Thu, 14 Dec 2023 13:21:18 +0100 Subject: [PATCH] Update the getIds() function --- pod/peer_to_peer/static/peer_to_peer/js/p2p-script.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/pod/peer_to_peer/static/peer_to_peer/js/p2p-script.js b/pod/peer_to_peer/static/peer_to_peer/js/p2p-script.js index 4bfc7c101b..a0f33c446c 100644 --- a/pod/peer_to_peer/static/peer_to_peer/js/p2p-script.js +++ b/pod/peer_to_peer/static/peer_to_peer/js/p2p-script.js @@ -43,16 +43,21 @@ async function getIds() { let postData = { 'url': videoId, }; + console.log('[p2p-script.js] postData:', postData); // TODO Update the URL - fetch('http://localhost:9090/peer-to-peer/get-ids/', { + await fetch('http://localhost:9090/peer-to-peer/get-ids/', { method: 'POST', headers: { 'Content-Type': 'application/json', }, body: JSON.stringify(postData), }).then(response => response.json()) - .then(response => console.log(response)) + .then(response => { + idList = [].concat(response); + console.log(idList); + }) .catch(err => console.error(err)); + return idList; } async function storeUrlsId() {