• 登录

fanwh / workai-design-blocks · 文件

GitLab

  • 转到仪表盘
  • 项目
  • 活动
  • 文件
  • 提交
  • 构建 0
  • 图表
  • 里程碑
  • 问题 0
  • 合并请求 0
  • 标记
  • 维基
  • 派生
  • 网络
  • workai-design-blocks
  • templates
  • login
  • src
  • model.js
  • add login page
      cf21cf10
    fanwh 在
    2020-09-27 18:47:15 +0800  
    创建 浏览文件 »
model.js 453 Bytes
原文件 审查 历史 永久链接
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
import { getText } from './service';

export default {
  namespace: 'BLOCK_NAME_CAMEL_CASE',
  state: {
    text: 'loading...',
  },

  effects: {
    *fetch(_, { call, put }) {
      const { text } = yield call(getText);
      yield put({
        type: 'save',
        payload: {
          text,
        },
      });
    },
  },

  reducers: {
    save(state, { payload }) {
      return {
        ...state,
        ...payload,
      };
    },
  },
};