home.js 924 Bytes
import {
	getSchoolListApi,
	getProjectListApi,
} from '@/config/api.js';

const state = () => ({
	schoolList: [],
	projectList: [],
})

const getters = {

}

const actions = {



	async getSchoolList({
		commit,
		dispatch,
		state
	}, params) {
		const result = await getSchoolListApi(params);
		if (result && result.records) {
			commit('setSchoolList', result);
			return result;
		}
	},

	async getProjectList({
		commit,
		dispatch,
		state
	}, params) {
		const result = await getProjectListApi(params);
		if (result && result.records) {
			commit('setProjectList', result);
			return result;
		}
	},

}

const mutations = {

	setSchoolList(state, result) {
		state.schoolList = result.records;
	},

	setProjectList(state, result) {
		state.projectList = result.records;
	},

}

export default {
	namespaced: true,
	state,
	getters,
	actions,
	mutations
}