{"size": 1800, "ext": "js", "max_stars_repo_path": "src/main/gui/front/src/store/modules/home.js", "max_stars_repo_name": "xpan635/dimpleblog", "max_stars_repo_stars_event_min_datetime": "2021-04-01T06:34:57.000Z", "max_stars_repo_stars_event_max_datetime": "2021-04-01T06:35:22.000Z", "max_issues_repo_path": "src/main/gui/front/src/store/modules/home.js", "max_issues_repo_name": "shixian0/DimpleBlog", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "src/main/gui/front/src/store/modules/home.js", "max_forks_repo_name": "shixian0/DimpleBlog", "max_forks_repo_forks_event_min_datetime": "2021-04-01T06:35:26.000Z", "max_forks_repo_forks_event_max_datetime": "2021-04-01T06:35:26.000Z"}
{"max_stars_count": 2, "max_issues_count": null, "max_forks_count": 2, "avg_line_length": 31.5789473684, "max_line_length": 76, "alphanum_fraction": 0.4688888889}
import {listBlogBaseInfo, listNoteBaseInfo, listBookBaseInfo} from '@/api'

export default {
    namespaced: true,
    state: {
        articles: [],
        books: [],
        notes: [],
    },
    mutations: {
        UPDATE_ARTICLES_BASE_INFO(state, articles) {
            state.articles = articles;
        },
        UPDATE_BOOKS_BASE_INFO(state, books) {
            state.books = books;
        },
        UPDATE_NOTES_BASE_INFO(state, notes) {
            state.notes = notes;
        },
    },
    actions: {
        // 获取文章基本信息
        GET_ARTICLES_BASE_INFO({state, commit}, params) {
            return new Promise((resolve, reject) => {
                listBlogBaseInfo(params).then((response) => {
                    commit('UPDATE_ARTICLES_BASE_INFO', response.rows);
                    resolve(response);
                }).catch((error) => {
                    reject(error);
                });
            });
        },
        // 获取图书基本信息
        GET_BOOKS_BASE_INFO({state, commit}, params) {
            return new Promise((resolve, reject) => {
                listBookBaseInfo(params).then((response) => {
                    commit('UPDATE_BOOKS_BASE_INFO', response.rows);
                    resolve(response);
                }).catch((error) => {
                    reject(error);
                });
            });
        },
        // 获取图书笔记基本信息
        GET_NOTES_BASE_INFO({state, commit}, params) {
            return new Promise((resolve, reject) => {
                listNoteBaseInfo(params).then((response) => {
                    commit('UPDATE_NOTES_BASE_INFO', response.data.results);
                    resolve(response);
                }).catch((error) => {
                    reject(error);
                });
            });
        },
    }
}
