import * as api from "../api/index";
import {Commit} from 'vuex'
interface State{
cateLeft:unknown[],
}
interface CateStore{
namespaced:boolean,
state:State,
actions:{
getCateLeft:({commit}:{commit:Commit}) =>void
},
mutations:{
GET_CATELEFT:(state:State,{payload}:{payload:unknown[]})=>void
}
}
const cateStore:CateStore = {
namespaced: true,
state: {
cateLeft: [],
},
actions: {
async getCateLeft({commit}) {
const res = await api.cateReq();
commit({type:'GET_CATELEFT',payload:res.data.data})
},
},
mutations: {
GET_CATELEFT(state,{payload}){
state.cateLeft=payload;
}
},
};
export default cateStore;