12345678910111213141516171819202122232425262728293031323334353637383940414243 |
- import { createAction, NavigationActions } from '../../utils'
- import * as authService from '../../services/auth'
- export default {
- namespace: 'category',
- state: {
- categorydata: [],
- },
- reducers: {
- categoryReducer(state, { payload }) {
- return { ...state, ...payload }
- },
- },
- effects: {
- //商品分类
- *getCategory(action, { call, put }) {
- try {
- const getcategory = yield call(authService.getcategory)
- if (getcategory.data) {
- yield put(
- createAction('categoryReducer')({
- categorydata: getcategory.data,
- })
- )
- }
- } catch (error) {
- console.log(
- error,
- '-----error的完整信息' + '\n' + error.response.data.message,
- '-----相关错误信息'
- )
- }
- },
- },
- // subscriptions: {
- // setup({ dispatch }) {
- // dispatch({ type: "getCategory" });
- // }
- // }
- }
|