{"size": 768, "ext": "js", "max_stars_repo_path": "client/src/store/modules/role.js", "max_stars_repo_name": "njbrunner/neighbor", "max_stars_repo_stars_event_min_datetime": "2020-04-06T03:31:25.000Z", "max_stars_repo_stars_event_max_datetime": "2020-04-06T03:31:25.000Z", "max_issues_repo_path": "client/src/store/modules/role.js", "max_issues_repo_name": "njbrunner/covid-19", "max_issues_repo_issues_event_min_datetime": "2020-04-17T00:44:01.000Z", "max_issues_repo_issues_event_max_datetime": "2020-05-01T20:39:31.000Z", "max_forks_repo_path": "client/src/store/modules/role.js", "max_forks_repo_name": "njbrunner/neighbor", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": 1, "max_issues_count": 16, "max_forks_count": null, "avg_line_length": 18.7317073171, "max_line_length": 74, "alphanum_fraction": 0.4739583333}
import axios from 'axios';

const state = {
    roles: undefined
};

const getters = {
    getRoles: state => state.roles
};

const actions = {
    getRoles({commit}) {
        return new Promise((resolve, reject) => {
            axios({
                url: 'https://covid-19-hackathon-app.herokuapp.com/role/',
                method: 'GET'
            })
            .then(response => {
                commit('updateRoles', response.data.roles);
                resolve(response);
            })
            .catch(error => {
                reject(error);
            });
        });
    }
};

const mutations = {
    updateRoles: (state, roles) => {
        state.roles = roles;
    },
};

export default {
    state,
    getters,
    actions,
    mutations
};
