diff --git a/src/container/product/GenRegis.js b/src/container/product/GenRegis.js index 0eb40e4..a6e3ba9 100644 --- a/src/container/product/GenRegis.js +++ b/src/container/product/GenRegis.js @@ -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 ( <> setNewRole({ ...newRole, part: e.target.value }) } - onClick={() => getParts()} /> {part && } 기수 @@ -173,7 +178,6 @@ export default function GenRegis() { onChange={(e) => setNewRole({ ...newRole, year: e.target.value }) } - onClick={() => getYears()} /> {year && } diff --git a/src/modules/ProductSlice.js b/src/modules/ProductSlice.js index ed8e5f9..e657652 100644 --- a/src/modules/ProductSlice.js +++ b/src/modules/ProductSlice.js @@ -5,6 +5,8 @@ const initialState = { modifyModalOpen: false, memberModalOpen: false, roleModalOpen: false, + genPart: '', + genYear: '', message: '', }; @@ -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; + }, }, }); @@ -52,4 +60,6 @@ export const { MemberModalclose, RoleModalopen, RoleModalclose, + setGenPart, + setGenYear, } = ProductSlice.actions; diff --git a/src/page/ManageGenPage.js b/src/page/ManageGenPage.js index 80918d9..765e3ec 100644 --- a/src/page/ManageGenPage.js +++ b/src/page/ManageGenPage.js @@ -204,7 +204,7 @@ export default function ManageGenPage() { {content.member} {content.role} {content.year} - {content.part} + {content.part ??
{content.part}
} {content.email} ))}