feat: load posts from remote URL

This commit is contained in:
ktyl 2024-07-14 14:34:36 +01:00
parent 7a2455e8da
commit bf242897b6
1 changed files with 3 additions and 2 deletions

View File

@ -216,8 +216,9 @@ function loadDataFromEndpoint(endpoint, callback) {
}); });
} }
loadDataFromEndpoint("users.json", json => { users = json.users; }); const baseUrl = "https://api.wayfarer.games/singularity";
loadDataFromEndpoint("posts.json", json => { loadDataFromEndpoint(`{baseUrl}/users.json`, json => { users = json.users; });
loadDataFromEndpoint(`{baseUrl}/posts.json`, json => {
// first pass to instantiate all the posts // first pass to instantiate all the posts
for (let i = 0; i < json.content.length; i++) { for (let i = 0; i < json.content.length; i++) {
const post = new Post(json.content[i]); const post = new Post(json.content[i]);