diff --git a/index.html b/index.html
index 7dd7821..9354c69 100644
--- a/index.html
+++ b/index.html
@@ -11,7 +11,18 @@
-
+
+
+
+
+
+ | Naam |
+ Beschrijving |
+
+
+
+
+
diff --git a/scripts/main.js b/scripts/main.js
index e69de29..7017c8a 100644
--- a/scripts/main.js
+++ b/scripts/main.js
@@ -0,0 +1,35 @@
+
+const api_url = "http://127.0.0.1:8000"
+
+var all_owned_games
+
+async function makeAPIRequest(request) {
+ try {
+ const response = await fetch(request);
+ const result = await response.json();
+ return result
+ } catch (error) {
+ console.error("Error:", error);
+ }
+}
+
+function add_boardgame_row(html_table, boardgame_json) {
+ var row = html_table.insertRow()
+ var name_cell = row.insertCell();
+ var description_cell = row.insertCell()
+
+ name_cell.innerHTML = boardgame_json.name
+ description_cell.innerHTML = boardgame_json.description
+}
+
+async function loadOwnedGames() {
+ const loadGamesRequest = new Request(api_url + "/owned")
+ all_owned_games = await makeAPIRequest(loadGamesRequest)
+
+ console.log("Loaded owned games:", all_owned_games)
+ var boardgame_table = document.getElementById("boardgame_table")
+
+ for (index = 0; index < all_owned_games.length; index++) {
+ add_boardgame_row(boardgame_table, all_owned_games[index])
+ }
+}
\ No newline at end of file