Skip to content

Commit

Permalink
Feat: 마일리지 학기별 항목 리스트도 리덕스로 관리 (#15)
Browse files Browse the repository at this point in the history
  • Loading branch information
ohinhyuk committed Aug 25, 2023
1 parent 3afd6e7 commit ab72cb6
Show file tree
Hide file tree
Showing 8 changed files with 24 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/components/board/MileageRegister.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -218,5 +218,5 @@ export default function MileageRegister() {
),
];

return <EnhancedTable rows={rows} headCells={headCells} type="마일리지 등록" />;
return <EnhancedTable originalRows={rows} headCells={headCells} type="마일리지 등록" />;
}
2 changes: 1 addition & 1 deletion src/components/board/MileageResult.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -188,5 +188,5 @@ export default function MileageResult() {
),
];

return <EnhancedTable rows={rows} headCells={headCells} type="마일리지 선정결과" />;
return <EnhancedTable originalRows={rows} headCells={headCells} type="마일리지 선정결과" />;
}
13 changes: 12 additions & 1 deletion src/components/board/MileageSemesterItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ import {
} from 'src/assets/data/fields';
import SWModal from '../common/modal/SWModal';
import { EDITITEM } from 'src/assets/data/modal/modals';
import { useSelector, dispatch } from 'src/redux/store';
import { useDispatch } from 'react-redux';
import { useEffect } from 'react';
import { setMileageSemesterList } from 'src/redux/slices/data';

/**
* @component [마일리지 학기별 항목] 게시판
Expand Down Expand Up @@ -233,5 +237,12 @@ export default function MileageSemesterItem() {
),
];

return <EnhancedTable rows={rows} headCells={headCells} type="마일리지 학기별 항목" />;
const data = useSelector((state) => state.data.mileageSemesterList);
const dispatch = useDispatch();

useEffect(() => {
dispatch(setMileageSemesterList(rows));
}, []);

return <EnhancedTable originalRows={data} headCells={headCells} type="마일리지 학기별 항목" />;
}
2 changes: 1 addition & 1 deletion src/components/board/MileageView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -217,5 +217,5 @@ export default function MileageView() {
),
];

return <EnhancedTable rows={rows} headCells={headCells} type="마일리지 조회" />;
return <EnhancedTable originalRows={rows} headCells={headCells} type="마일리지 조회" />;
}
2 changes: 1 addition & 1 deletion src/components/board/RegisterManage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -223,5 +223,5 @@ export default function RegisterManage() {
),
];

return <EnhancedTable rows={rows} headCells={headCells} type="신청자 관리" />;
return <EnhancedTable originalRows={rows} headCells={headCells} type="신청자 관리" />;
}
2 changes: 1 addition & 1 deletion src/components/board/StudentManage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -223,5 +223,5 @@ export default function StudentManage() {
),
];

return <EnhancedTable rows={rows} headCells={headCells} type="학생 관리" />;
return <EnhancedTable originalRows={rows} headCells={headCells} type="학생 관리" />;
}
2 changes: 1 addition & 1 deletion src/components/board/UserManage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -104,5 +104,5 @@ export default function UserManage() {
createData(5, '김광', '21800450', '관리자', '20(2023-08-22)'),
];

return <EnhancedTable rows={rows} headCells={headCells} type="사용자 관리" />;
return <EnhancedTable originalRows={rows} headCells={headCells} type="사용자 관리" />;
}
7 changes: 6 additions & 1 deletion src/redux/slices/data.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { createSlice } from '@reduxjs/toolkit';
const initialState = {
mileageCategoryList: [],
mileageGlobalList: [],
mileageSemesterList: [],
};

const slice = createSlice({
Expand All @@ -15,9 +16,13 @@ const slice = createSlice({
setMileageGlobalList: (state, action) => {
state.mileageGlobalList = action.payload;
},
setMileageSemesterList: (state, action) => {
state.mileageSemesterList = action.payload;
},
},
});

// Reducer
export const { setMileageCategoryList, setMileageGlobalList } = slice.actions;
export const { setMileageCategoryList, setMileageGlobalList, setMileageSemesterList } =
slice.actions;
export default slice.reducer;

0 comments on commit ab72cb6

Please sign in to comment.