Skip to content

Commit

Permalink
feat: 리덕스 적용중
Browse files Browse the repository at this point in the history
  • Loading branch information
HongBoogie committed Feb 12, 2024
1 parent 6abc52d commit d802f31
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 3 deletions.
8 changes: 6 additions & 2 deletions src/container/product/GenRegis.js
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,12 @@ export default function GenRegis() {
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [roleModalOpen]);

useEffect(() => {
getParts();
getYears();
// eslint-disable-next-line react-hooks/exhaustive-deps
}, []);

return (
<>
<ModalContainer
Expand Down Expand Up @@ -162,7 +168,6 @@ export default function GenRegis() {
onChange={(e) =>
setNewRole({ ...newRole, part: e.target.value })
}
onClick={() => getParts()}
/>
{part && <Container data={part} />}
<ModalLabel>기수</ModalLabel>
Expand All @@ -173,7 +178,6 @@ export default function GenRegis() {
onChange={(e) =>
setNewRole({ ...newRole, year: e.target.value })
}
onClick={() => getYears()}
/>
{year && <Container data={year} />}
<ModalButtonWrapper>
Expand Down
10 changes: 10 additions & 0 deletions src/modules/ProductSlice.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ const initialState = {
modifyModalOpen: false,
memberModalOpen: false,
roleModalOpen: false,
genPart: '',
genYear: '',
message: '',
};

Expand Down Expand Up @@ -40,6 +42,12 @@ export const ProductSlice = createSlice({
RoleModalclose(state) {
state.roleModalOpen = false;
},
setGenPart(state, action) {
state.genPart = action.payload;
},
setGenYear(state, action) {
state.genYear = action.payload;
},
},
});

Expand All @@ -52,4 +60,6 @@ export const {
MemberModalclose,
RoleModalopen,
RoleModalclose,
setGenPart,
setGenYear,
} = ProductSlice.actions;
2 changes: 1 addition & 1 deletion src/page/ManageGenPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ export default function ManageGenPage() {
<td>{content.member}</td>
<td>{content.role}</td>
<td>{content.year}</td>
<td>{content.part}</td>
<td>{content.part ?? <div>{content.part}</div>}</td>
<td>{content.email}</td>
</tr>
))}
Expand Down

0 comments on commit d802f31

Please sign in to comment.