-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.js
33 lines (28 loc) · 946 Bytes
/
main.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
//fetch('data.json').then(response => {return response.json();}).then(data => {console.log(data);});
// async function getData(){
// const response = await fetch('data.json');
// const data = await response.json();
// const queryString = window.location.search;
// const urlParams = new URLSearchParams(queryString);
// console.log(queryString);
// console.log(data);
// renderMainPage(data);
// };
import {renderMainPage} from './mainPage.js';
import {renderProjectPage} from './projectPage.js';
fetch('data.json')
.then(response => {
return response.json();
})
.then(data => {
const queryString = window.location.search;
const urlParams = new URLSearchParams(queryString);
if (urlParams.get("project") === null){
renderMainPage(data);
} else {
let id = urlParams.get("project");
if (id == "othello"){
renderProjectPage(data.othello)
}
}
});