Browse Source

참여 그룹 목록(데이터 안뜨는 현상 해결)

pull/2/head
sanguu 2 years ago
parent
commit
ca49af45a3
  1. 22
      src/modules/basis/group/reducers/basisGroupReducer.ts
  2. 5
      src/modules/basis/group/sagas/basisGroupSaga.ts

22
src/modules/basis/group/reducers/basisGroupReducer.ts

@ -22,7 +22,7 @@ export const groupReducer = createReducer<GroupState, Actions.GroupAction>(
if (res.aprvlYn === 'Y') { if (res.aprvlYn === 'Y') {
return res; return res;
} }
}) });
draft.joinList = agreeList; draft.joinList = agreeList;
draft.joinListCount = agreeList.length; draft.joinListCount = agreeList.length;
@ -34,18 +34,16 @@ export const groupReducer = createReducer<GroupState, Actions.GroupAction>(
produce(state, draft => { produce(state, draft => {
const { data, count } = action.payload; const { data, count } = action.payload;
console.log(data); console.log(data);
// const agreeList = data.filter(res => {
// if (res.aprvlYn === 'Y') {
// return res;
// }
// });
// draft.mainList = agreeList;
// draft.mainListCount = agreeList.length;
const agreeList = data.filter(res => { draft.mainList = data;
if(res.aprvlYn === 'Y') { draft.mainListCount = count;
return res;
}
})
draft.mainList = agreeList;
draft.mainListCount = agreeList.length;
// draft.mainList = data;
// draft.mainListCount = count;
}) })
) )
.handleAction(Actions.GROUP_MYLIST.success, (state, action) => .handleAction(Actions.GROUP_MYLIST.success, (state, action) =>

5
src/modules/basis/group/sagas/basisGroupSaga.ts

@ -90,6 +90,7 @@ function* GrouplistSaga(
const { data, count, errorCode, errorMessage } = res; const { data, count, errorCode, errorMessage } = res;
if (errorCode) { if (errorCode) {
// 오류메시지 호출 // 오류메시지 호출
debugger;
yield put( yield put(
MessageActions.IS_ERROR({ MessageActions.IS_ERROR({
errorCode: errorCode, errorCode: errorCode,
@ -103,13 +104,13 @@ function* GrouplistSaga(
} }
yield put( yield put(
Actions.JOIN_LIST.success({ Actions.GROUP_MAIN_LIST.success({
data: data, data: data,
count: count count: count
}) })
); );
} catch (error) { } catch (error) {
yield put(Actions.JOIN_LIST.failure(error)); yield put(Actions.GROUP_MAIN_LIST.failure(error));
} }
} }
function* myJoinSaga(action: ActionType<typeof Actions.GROUP_MYLIST.request>) { function* myJoinSaga(action: ActionType<typeof Actions.GROUP_MYLIST.request>) {

Loading…
Cancel
Save