feat: load posts from remote URL
This commit is contained in:
parent
7a2455e8da
commit
bf242897b6
5
main.js
5
main.js
|
@ -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]);
|
||||||
|
|
Loading…
Reference in New Issue