davvalent commited on 2023-03-15 16:49:08
Showing 1 changed files, with 21 additions and 7 deletions.
| ... | ... |
@@ -16,12 +16,25 @@ |
| 16 | 16 |
let tilesUrl = "https://ntnlv.ca/faubourg/tiles/{z}/{x}/{y}.png",
|
| 17 | 17 |
tripleStoreEndpointUrl = "http://qdmtl.ca/sparql/endpoint.php"; |
| 18 | 18 |
|
| 19 |
- /** Fetch values for dev env */ |
|
| 20 |
- if (dev()) { // develop
|
|
| 21 |
- response = await fetch("./js/config.json"); // config.json is .gitignored
|
|
| 22 |
- const dev = await response.json(); |
|
| 23 |
- tilesUrl = dev.devUrl; |
|
| 24 |
- tripleStoreEndpointUrl = dev.tripleStoreEndpointUrl; |
|
| 19 |
+ /** |
|
| 20 |
+ * Fetch values for dev env |
|
| 21 |
+ * Store dev env values in session storage |
|
| 22 |
+ * ./js/config.json is .gitignored |
|
| 23 |
+ */ |
|
| 24 |
+ if (dev()) {
|
|
| 25 |
+ |
|
| 26 |
+ response = await fetch("./js/config.json");
|
|
| 27 |
+ const devConfiguration = await response.json(); |
|
| 28 |
+ |
|
| 29 |
+ for (const prop in devConfiguration) {
|
|
| 30 |
+ sessionStorage.setItem(prop, devConfiguration[prop]); |
|
| 31 |
+ } |
|
| 32 |
+ |
|
| 33 |
+ tilesUrl = devConfiguration.devTilesUrl; |
|
| 34 |
+ |
|
| 35 |
+ if (!devConfiguration.onLineTripleStore) {
|
|
| 36 |
+ tripleStoreEndpointUrl = devConfiguration.devTripleStoreEndpointUrl; |
|
| 37 |
+ } |
|
| 25 | 38 |
} |
| 26 | 39 |
|
| 27 | 40 |
/** SPARQL query */ |
| ... | ... |
@@ -42,8 +55,9 @@ |
| 42 | 55 |
body: buildingsQuery |
| 43 | 56 |
}); |
| 44 | 57 |
const sparqlResults = await response.json(); |
| 58 |
+ |
|
| 45 | 59 |
if (dev()) { // develop
|
| 46 |
- console.log(sparqlResults); |
|
| 60 |
+ console.log("Dev:", sparqlResults);
|
|
| 47 | 61 |
}; |
| 48 | 62 |
|
| 49 | 63 |
/** |
| 50 | 64 |