{"size": 1184, "ext": "js", "max_stars_repo_path": "src/http/http.js", "max_stars_repo_name": "Iliyan7/sample-react-app", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "src/http/http.js", "max_issues_repo_name": "Iliyan7/sample-react-app", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "src/http/http.js", "max_forks_repo_name": "Iliyan7/sample-react-app", "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.2156862745, "max_line_length": 78, "alphanum_fraction": 0.4949324324}
const BASE_URL = 'https://9sf7x3qadg.execute-api.eu-west-1.amazonaws.com/api/'

class Http {
    async get(endpoint = '') {
        const url = BASE_URL + endpoint
        const response = await fetch(url, {
            method: 'GET',
        });

        return response.json();
    }

    async post(endpoint = '', data = {}) {
        const url = BASE_URL + endpoint
        const response = await fetch(url, {
            method: 'POST',
            headers: {
                'Content-Type': 'application/json'
            },
            body: JSON.stringify(data)
        });

        return response.json();
    }

    async update(endpoint = '', data = {}) {
        const url = BASE_URL + endpoint
        const response = await fetch(url, {
            method: 'PUT',
            headers: {
                'Content-Type': 'application/json'
            },
            body: JSON.stringify(data)
        });

        return response.json();
    }

    async delete(endpoint = '') {
        const url = BASE_URL + endpoint
        const response = await fetch(url, {
            method: 'DELETE',
        });

        return response.ok;
    }


}

export default new Http();