static async fetchConfig()

in source/5-unicornPics/webapp/src/Api.tsx [25:39]


    static async  fetchConfig(url = 'config.json') {
        if(!this.config) {
            try {
                const response = await fetch(url);
                this.config = await response.json();
                console.debug("(Loading config.json) config.json content = ", this.config);
                return this.config;
                } catch (e) {
                console.error(`error loading json ${e}`);
                }
        } else {
            console.log(`config.json ${JSON.stringify(this.config)}`);
            return this.config;
        } 
        }