import { getNoticeDetailDataAPI, updateNoticeReadAPI } from "../services/api";

export default {
  namespace: "noticeDetail",

  state: {},

  effects: {
    *getNoticeDetailData({ payload }, { call, put }) {
      const response = yield call(getNoticeDetailDataAPI, payload);
      yield put({
        type: "noticeDetailData",
        noticeDetailData: response
      });
    },
    *updateNoticeRead({ payload }, { call, put }) {
      yield call(updateNoticeReadAPI, payload);
    }
  },
  reducers: {
    noticeDetailData(state, payload) {
      return {
        ...state,
        noticeDetailData: payload.noticeDetailData
      };
    }
  }
};
