import { getSchoolListApi } from "@/api/smartCampus/index";

const useSchoolStore = defineStore("school", {
  state: () => ({
    schoolList: [],
  }),
  actions: {
    // 超管角色获取学校列表
    getSchoolList(data) {
      return new Promise((resolve, reject) => {
        getSchoolListApi(data)
          .then((res) => {
            this.schoolList = res.rows;
            resolve(res);
          })
          .catch((error) => {
            reject(error);
          });
      });
    },
  },
});

export default useSchoolStore;
