{"size": 951, "ext": "js", "max_stars_repo_path": "resources/js/components/shared/services/CompanyServices.js", "max_stars_repo_name": "CristianMateus/LaravelReactFullStack", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "resources/js/components/shared/services/CompanyServices.js", "max_issues_repo_name": "CristianMateus/LaravelReactFullStack", "max_issues_repo_issues_event_min_datetime": "2021-03-09T19:45:12.000Z", "max_issues_repo_issues_event_max_datetime": "2022-02-18T12:15:43.000Z", "max_forks_repo_path": "resources/js/components/shared/services/CompanyServices.js", "max_forks_repo_name": "CristianMateus/LaravelReactFullStack", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": 4, "max_forks_count": null, "avg_line_length": 27.9705882353, "max_line_length": 74, "alphanum_fraction": 0.5993690852}
import axios from "axios";

export const getAllCompanies = async () => {
    return await axios
        .get("/api/company")
        .then(response => {
            return response.data;
        })
        .catch(error => console.error(error));
};

export const deleteCompany = async companyId => {
    return await axios
        .delete(`/api/company/${companyId}`)
        .then(response => {
            return response.data;
        })
        .catch(error => console.error(error));
};

export const saveCompany = async newCompany => {
    return await axios
        .post("/api/company", newCompany)
        .then(response => response.data)
        .catch(error => console.error(error));
};

export const updateCompany = async (updatedCompanyId, updatedCompany) => {
    return await axios
        .put(`/api/company/${updatedCompanyId}`, updatedCompany)
        .then(response => response.data)
        .catch(error => console.error(error));
};
