import { AppDispatch } from ".."
import http from "@/utils/http"

// 获取分类
export const getSortAction = () => {

  return async (dispatch: AppDispatch) => {
    const res = await http.post('/api/show/getTree', { type: 'texture' })
    dispatch({ type: 'home/setSort', payload: res.data })
  }
}

// 获取列表数据
export const getListAction = (data: any) => {

  return async (dispatch: AppDispatch) => {
    const res = await http.post('/api/show/goods/list', data)
    const list =res.data.records
    const total =res.data.total
    dispatch({ type: 'home/setList', payload: {list,total} })

  }
}


