{"size": 656, "ext": "js", "max_stars_repo_path": "resources/assets/js/eventHub.js", "max_stars_repo_name": "beprolife200/be-pro", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "resources/assets/js/eventHub.js", "max_issues_repo_name": "beprolife200/be-pro", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "resources/assets/js/eventHub.js", "max_forks_repo_name": "beprolife200/be-pro", "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": 28.5217391304, "max_line_length": 63, "alphanum_fraction": 0.506097561}
import Vue from 'vue'

import { alert } from '@js/utils'

Vue.prototype.$eventHub = window.$eventHub = new Vue({
    created() {
        this.$on('store-post', this.store)
        this.$on('save-post', this.save)
    },
    methods: {
        save(post) {
            window.axios.put(`/api/posts/${post.slug}`, post)
                .then(res => alert(res.data.message))
                .catch(res => alert(res.data.message, 'error'))
        },
        store(post) {
            window.axios.post('/api/posts', post)
                .then(res => alert(res.data.message))
                .catch(res => alert(res.data.message, 'error'))
        }
    }
})
