Use client-side config files to config things

This commit is contained in:
Gabe Kangas
2020-06-16 18:55:00 -07:00
parent ca4932e2b4
commit c6e4ea8349
4 changed files with 18 additions and 30 deletions

View File

@@ -1,9 +1,4 @@
class Config {
constructor() {
this.init();
}
async init() {
const configFileLocation = "./js/config.json";
@@ -11,6 +6,7 @@ class Config {
const response = await fetch(configFileLocation);
const configData = await response.json();
Object.assign(this, configData);
return this;
} catch(error) {
console.log(error);
// No config file present. That's ok. It's not required.