Skip to content

Commit

Permalink
Add search for user #11
Browse files Browse the repository at this point in the history
  • Loading branch information
Scobiform committed Apr 19, 2024
1 parent c82c437 commit 571cd43
Showing 1 changed file with 14 additions and 7 deletions.
21 changes: 14 additions & 7 deletions templates/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 571cd43

Please sign in to comment.