{"size": 475, "ext": "js", "max_stars_repo_path": "src/storesAdapter.js", "max_stars_repo_name": "karegan4/shopping-list-api-front-end", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "src/storesAdapter.js", "max_issues_repo_name": "karegan4/shopping-list-api-front-end", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "src/storesAdapter.js", "max_forks_repo_name": "karegan4/shopping-list-api-front-end", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 23.75, "max_line_length": 64, "alphanum_fraction": 0.5326315789}
class StoresAdapter{
    constructor(){
        this.baseUrl = 'http://localhost:3000/stores'
    }

    fetchStores(){
        fetch(this.baseUrl)
        .then(res => res.json())
        .then(response => {
            response.data.forEach(el => {
                this.sanitizeAndInitializeStore(el)
            })
        })
    }

    sanitizeAndInitializeStore(data) {
        let store = new Store({id: data.id, ...data.attributes})
        store.attachToDom()
    }
}