This commit is contained in:
Skylar Grant 2024-08-14 20:26:40 -04:00
parent b30caa1c60
commit 1e55c058b9

View File

@ -1,22 +1,22 @@
import { Communicator,State } from './HestiaClasses.js'; import { Communicator,State } from './HestiaClasses.js';
window.onload = async function() { window.onload = async function() {
const config = await fetch('/assets/config.json') await fetch('/assets/config.json')
.then(response => { .then(response => {
if (!response.ok) { if (!response.ok) {
throw new Error('Network response was not ok'); throw new Error('Network response was not ok');
}
return response.json(); // Parse the JSON data from the response
}) })
.then(data => { .then(data => {
console.log(data); // Use the JSON data here const config = data;
return data; console.log(config);
const psState = new State(config);
refreshState(window.document, psState);
}) })
.catch(error => { .catch(error => {
console.error('There was a problem with the fetch operation:', error); console.error('There was a problem with the fetch operation:', error);
}); });
console.log(config);
const psState = new State(config);
refreshState(window.document, psState);
}; };
function refreshState(doc, state) { function refreshState(doc, state) {