Michael Rabinovich commited on
Commit ·
79711e2
1
Parent(s): 69c9226
changed index
Browse files- index.html +19 -9
index.html
CHANGED
|
@@ -7,13 +7,23 @@
|
|
| 7 |
<link rel="stylesheet" href="style.css" />
|
| 8 |
</head>
|
| 9 |
<body>
|
| 10 |
-
<div
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 18 |
</body>
|
| 19 |
-
</html>
|
|
|
|
| 7 |
<link rel="stylesheet" href="style.css" />
|
| 8 |
</head>
|
| 9 |
<body>
|
| 10 |
+
<div id="app"></div>
|
| 11 |
+
|
| 12 |
+
<script>
|
| 13 |
+
const params = new URLSearchParams(window.location.search);
|
| 14 |
+
const view = params.get("view") || "home";
|
| 15 |
+
|
| 16 |
+
fetch(view + ".html")
|
| 17 |
+
.then(res => {
|
| 18 |
+
if (!res.ok) throw new Error("Page not found");
|
| 19 |
+
return res.text();
|
| 20 |
+
})
|
| 21 |
+
.then(html => {
|
| 22 |
+
document.getElementById("app").innerHTML = html;
|
| 23 |
+
})
|
| 24 |
+
.catch(() => {
|
| 25 |
+
document.getElementById("app").innerHTML = "<h1>Page not found</h1>";
|
| 26 |
+
});
|
| 27 |
+
</script>
|
| 28 |
</body>
|
| 29 |
+
</html>
|