From 571cd43812d30acd8f8f2b01f9783d3dd4e850eb Mon Sep 17 00:00:00 2001 From: Scobiform Date: Fri, 19 Apr 2024 18:33:00 +0200 Subject: [PATCH] Add search for user #11 --- templates/index.html | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/templates/index.html b/templates/index.html index 5a8a1b5..673f40f 100644 --- a/templates/index.html +++ b/templates/index.html @@ -96,13 +96,20 @@ } async function loadGraph(userId) { - const followers = await fetchAllItems(userId, 'followers', apiBaseUrl); - const followings = await fetchAllItems(userId, 'following', apiBaseUrl); - // Generate graph data - graphData = generateGraphData(userId, userName, userAvatar, followers, followings); - // Calculate the number of connections for each node - calculateNodeConnections(graphData.nodes, graphData.links); - window.graph = initGraph(graphData); + try { + const followers = await fetchAllItems(userId, 'followers', 'https://your-api-url.com'); + const followings = await fetchAllItems(userId, 'following', 'https://your-api-url.com'); + const userName = '{{ user.username }}'; + const userAvatar = '{{ user.avatar }}'; + + // Generate graph data + const graphData = generateGraphData(userId, userName, userAvatar, followers, followings); + // Calculate the number of connections for each node + calculateNodeConnections(graphData.nodes, graphData.links); + window.graph = initGraph(graphData); + } catch (error) { + console.error('Failed to load graph data:', error); + } } async function handleKeyUp(event) {