diff --git a/frontend/.eslintrc.json b/frontend/.eslintrc.json index 6d163eb73..88b88bb65 100644 --- a/frontend/.eslintrc.json +++ b/frontend/.eslintrc.json @@ -22,7 +22,7 @@ "eqeqeq": "error", "dot-notation": "warn", "no-unused-vars": "off", - "@typescript-eslint/no-unused-vars": ["error"], + "@typescript-eslint/no-unused-vars": ["error", { "varsIgnorePattern": "_" }], "unused-imports/no-unused-imports": "error", "unused-imports/no-unused-vars": [ "warn", diff --git a/frontend/playwright-report/index.html b/frontend/playwright-report/index.html deleted file mode 100644 index daa8bc7ed..000000000 --- a/frontend/playwright-report/index.html +++ /dev/null @@ -1,68 +0,0 @@ - - - - - - - - - Playwright Test Report - - - - -
- - - \ No newline at end of file diff --git a/frontend/src/apis/checklist.ts b/frontend/src/apis/checklist.ts index 7c5149875..90663d328 100644 --- a/frontend/src/apis/checklist.ts +++ b/frontend/src/apis/checklist.ts @@ -1,7 +1,8 @@ import fetcher from '@/apis/fetcher'; import { BASE_URL, ENDPOINT } from '@/apis/url'; +import { roomInfoApiMapper } from '@/store/roomInfoStore'; import { ChecklistInfo, ChecklistPostForm, ChecklistSelectedQuestions } from '@/types/checklist'; -import { mapObjNullToUndefined, mapObjUndefinedToNull } from '@/utils/typeFunctions'; +import { mapObjNullToUndefined } from '@/utils/typeFunctions'; export const getChecklistQuestions = async () => { const response = await fetcher.get({ url: BASE_URL + ENDPOINT.CHECKLIST_QUESTION }); @@ -28,16 +29,17 @@ export const getChecklists = async () => { }; export const postChecklist = async (checklist: ChecklistPostForm) => { - checklist.room.structure = checklist.room.structure === 'NONE' ? undefined : checklist.room.structure; - checklist.room = mapObjUndefinedToNull(checklist.room); - const response = await fetcher.post({ url: BASE_URL + ENDPOINT.CHECKLISTS_V1, body: checklist }); + const room = roomInfoApiMapper(checklist.room); + const response = await fetcher.post({ + url: BASE_URL + ENDPOINT.CHECKLISTS_V1, + body: { ...checklist, room }, + }); return response; }; export const putChecklist = async (id: number, checklist: ChecklistPostForm) => { - checklist.room.structure = checklist.room.structure === 'NONE' ? undefined : checklist.room.structure; - checklist.room = mapObjUndefinedToNull(checklist.room); - const response = await fetcher.put({ url: BASE_URL + ENDPOINT.CHECKLIST_ID(id), body: checklist }); + const room = roomInfoApiMapper(checklist.room); + const response = await fetcher.put({ url: BASE_URL + ENDPOINT.CHECKLIST_ID(id), body: { ...checklist, room } }); return response; }; diff --git a/frontend/src/components/NewChecklist/MemoModal/MemoModal.tsx b/frontend/src/components/NewChecklist/MemoModal/MemoModal.tsx index 7f08f6c70..c94110dae 100644 --- a/frontend/src/components/NewChecklist/MemoModal/MemoModal.tsx +++ b/frontend/src/components/NewChecklist/MemoModal/MemoModal.tsx @@ -1,12 +1,11 @@ import styled from '@emotion/styled'; import { useRef } from 'react'; -import { useStore } from 'zustand'; import Button from '@/components/_common/Button/Button'; import Modal from '@/components/_common/Modal/Modal'; import Textarea from '@/components/_common/Textarea/Textarea'; import useInput from '@/hooks/useInput'; -import checklistRoomInfoStore from '@/store/checklistRoomInfoStore'; +import useRoomInfoValidated from '@/hooks/useRoomInfoValidated'; import { flexCenter, title3 } from '@/styles/common'; import theme from '@/styles/theme'; @@ -17,9 +16,8 @@ interface Props { const MemoModal = ({ isModalOpen, modalClose }: Props) => { const intervalRef = useRef(undefined); - const checklistRoomInfoActions = useStore(checklistRoomInfoStore, state => state.actions); - const memo = useStore(checklistRoomInfoStore, state => state.value.memo); - const { value: memoValue, onChange } = useInput(memo || ''); + const memo = useRoomInfoValidated('memo'); + const { value: memoValue, onChange } = useInput(memo.rawValue || ''); const handleInputChange = (e: React.ChangeEvent) => { onChange(e); @@ -33,7 +31,7 @@ const MemoModal = ({ isModalOpen, modalClose }: Props) => { }; const handleSubmit = (addModalClose: boolean) => { - checklistRoomInfoActions.set('memo', memoValue); + memo.set(memoValue); if (addModalClose) modalClose(); }; diff --git a/frontend/src/components/NewChecklist/NewChecklistContent.tsx b/frontend/src/components/NewChecklist/NewChecklistContent.tsx index 5cefd2bd2..a4f5c3f21 100644 --- a/frontend/src/components/NewChecklist/NewChecklistContent.tsx +++ b/frontend/src/components/NewChecklist/NewChecklistContent.tsx @@ -9,6 +9,7 @@ import OptionChecklistTemplate from '@/components/NewChecklist/Option/OptionChec import useInitialChecklist from '@/hooks/useInitialChecklist'; const NewChecklistContent = () => { + useInitialChecklist(); const { currentTabId } = useTabContext(); useInitialChecklist(); return ( diff --git a/frontend/src/components/NewChecklist/NewRoomInfoForm/DepositAndRent.tsx b/frontend/src/components/NewChecklist/NewRoomInfoForm/DepositAndRent.tsx index d4c0f249b..e8c35b057 100644 --- a/frontend/src/components/NewChecklist/NewRoomInfoForm/DepositAndRent.tsx +++ b/frontend/src/components/NewChecklist/NewRoomInfoForm/DepositAndRent.tsx @@ -1,17 +1,12 @@ -import { useStore } from 'zustand'; - import FormField from '@/components/_common/FormField/FormField'; import FormStyled from '@/components/NewChecklist/NewRoomInfoForm/styled'; -import checklistRoomInfoStore from '@/store/checklistRoomInfoStore'; +import useRoomInfoValidated from '@/hooks/useRoomInfoValidated'; const DepositAndRent = () => { - const actions = useStore(checklistRoomInfoStore, state => state.actions); - const deposit = useStore(checklistRoomInfoStore, state => state.rawValue.deposit); - const rent = useStore(checklistRoomInfoStore, state => state.rawValue.rent); - const errorMessageDeposit = useStore(checklistRoomInfoStore, state => state.errorMessage.deposit); - const errorMessageRent = useStore(checklistRoomInfoStore, state => state.errorMessage.rent); + const deposit = useRoomInfoValidated('deposit'); + const rent = useRoomInfoValidated('rent'); - const errorMessage = errorMessageDeposit || errorMessageRent; + const errorMessage = deposit.errorMessage || rent.errorMessage; return ( @@ -19,18 +14,18 @@ const DepositAndRent = () => { diff --git a/frontend/src/components/NewChecklist/NewRoomInfoForm/IncludedMaintenances.tsx b/frontend/src/components/NewChecklist/NewRoomInfoForm/IncludedMaintenances.tsx index 8abbfd51a..633786daa 100644 --- a/frontend/src/components/NewChecklist/NewRoomInfoForm/IncludedMaintenances.tsx +++ b/frontend/src/components/NewChecklist/NewRoomInfoForm/IncludedMaintenances.tsx @@ -6,25 +6,24 @@ import FlexBox from '@/components/_common/FlexBox/FlexBox'; import FormField from '@/components/_common/FormField/FormField'; import FormStyled from '@/components/NewChecklist/NewRoomInfoForm/styled'; import { IncludedMaintenancesData } from '@/constants/roomInfo'; -import checklistRoomInfoStore from '@/store/checklistRoomInfoStore'; +import roomInfoStore from '@/store/roomInfoStore'; const IncludedMaintenances = () => { - const actions = useStore(checklistRoomInfoStore, state => state.actions); - const includedMaintenances = useStore(checklistRoomInfoStore, state => state.value.includedMaintenances); + // TODO : nonValidated 에서 관리해야함. 일단은 놔뒀음. - const handleCheckIncluded = (id: number) => !!includedMaintenances?.includes(id); + const includedMaintenances = useStore(roomInfoStore, state => state.includedMaintenances).rawValue; + const actions = useStore(roomInfoStore, state => state.actions); - const handleToggleButton = useCallback( - (value: number) => { - const isIncluded = handleCheckIncluded(value); - - const updatedValue = isIncluded - ? includedMaintenances?.filter(id => id !== value) - : [...(includedMaintenances || []), value]; + const isIncluded = useCallback((id: number) => includedMaintenances.includes(id), [includedMaintenances]); - actions.set('includedMaintenances', updatedValue); + const handleToggleButton = useCallback( + (clickedId: number) => { + const updatedValue = isIncluded(clickedId) + ? includedMaintenances.filter(id => id !== clickedId) + : [...(includedMaintenances || []), clickedId]; + actions.set({ includedMaintenances: { rawValue: updatedValue, errorMessage: '' } }); }, - [includedMaintenances, actions], + [includedMaintenances, actions, isIncluded], ); return ( @@ -37,7 +36,7 @@ const IncludedMaintenances = () => { label={displayName} name={displayName} size="button" - isSelected={handleCheckIncluded(id)} + isSelected={isIncluded(id)} onClick={() => handleToggleButton(id)} /> ))} diff --git a/frontend/src/components/NewChecklist/NewRoomInfoForm/MaintenanceFee.tsx b/frontend/src/components/NewChecklist/NewRoomInfoForm/MaintenanceFee.tsx index 73bf9f1b6..a81df9a7d 100644 --- a/frontend/src/components/NewChecklist/NewRoomInfoForm/MaintenanceFee.tsx +++ b/frontend/src/components/NewChecklist/NewRoomInfoForm/MaintenanceFee.tsx @@ -1,14 +1,10 @@ -import { useStore } from 'zustand'; - import FormField from '@/components/_common/FormField/FormField'; import Input from '@/components/_common/Input/Input'; import FormStyled from '@/components/NewChecklist/NewRoomInfoForm/styled'; -import checklistRoomInfoStore from '@/store/checklistRoomInfoStore'; +import useRoomInfoValidated from '@/hooks/useRoomInfoValidated'; const MaintenanceFee = () => { - const actions = useStore(checklistRoomInfoStore, state => state.actions); - const maintenanceFee = useStore(checklistRoomInfoStore, state => state.rawValue.maintenanceFee); - const errorMessage = useStore(checklistRoomInfoStore, state => state.errorMessage.maintenanceFee); + const maintenanceFee = useRoomInfoValidated('maintenanceFee'); return ( @@ -17,14 +13,14 @@ const MaintenanceFee = () => { - + ); }; diff --git a/frontend/src/components/NewChecklist/NewRoomInfoForm/OccupancyMonth.tsx b/frontend/src/components/NewChecklist/NewRoomInfoForm/OccupancyMonth.tsx index 7483c3c50..ab9c04c12 100644 --- a/frontend/src/components/NewChecklist/NewRoomInfoForm/OccupancyMonth.tsx +++ b/frontend/src/components/NewChecklist/NewRoomInfoForm/OccupancyMonth.tsx @@ -1,20 +1,14 @@ -import { useStore } from 'zustand'; - import Dropdown from '@/components/_common/Dropdown/Dropdown'; import FlexBox from '@/components/_common/FlexBox/FlexBox'; import FormField from '@/components/_common/FormField/FormField'; import FormStyled from '@/components/NewChecklist/NewRoomInfoForm/styled'; import { roomOccupancyPeriods } from '@/constants/roomInfo'; -import checklistRoomInfoStore from '@/store/checklistRoomInfoStore'; +import useRoomInfoValidated from '@/hooks/useRoomInfoValidated'; const OccupancyMonth = () => { - const actions = useStore(checklistRoomInfoStore, state => state.actions); - const occupancyMonth = useStore(checklistRoomInfoStore, state => state.rawValue.occupancyMonth); - const occupancyPeriod = useStore(checklistRoomInfoStore, state => state.rawValue.occupancyPeriod); - - const errorMessageOccupancyMonth = useStore(checklistRoomInfoStore, state => state.errorMessage.occupancyMonth); - const errorMessageOccupancyPeriod = useStore(checklistRoomInfoStore, state => state.errorMessage.occupancyPeriod); - const errorMessage = errorMessageOccupancyMonth || errorMessageOccupancyPeriod; + const occupancyMonth = useRoomInfoValidated('occupancyMonth'); + const occupancyPeriod = useRoomInfoValidated('occupancyPeriod'); + const errorMessage = occupancyMonth.errorMessage || occupancyPeriod.errorMessage; return ( @@ -22,18 +16,16 @@ const OccupancyMonth = () => { ({ value }))} - onSelectSetter={(level: string) => { - actions.set('occupancyPeriod', level); - }} + onSelectSetter={(level: string) => occupancyPeriod.set(level)} /> diff --git a/frontend/src/components/NewChecklist/NewRoomInfoForm/RealEstate.tsx b/frontend/src/components/NewChecklist/NewRoomInfoForm/RealEstate.tsx index d847c6cf5..61b9f65b5 100644 --- a/frontend/src/components/NewChecklist/NewRoomInfoForm/RealEstate.tsx +++ b/frontend/src/components/NewChecklist/NewRoomInfoForm/RealEstate.tsx @@ -1,12 +1,8 @@ -import { useStore } from 'zustand'; - import FormField from '@/components/_common/FormField/FormField'; -import checklistRoomInfoStore from '@/store/checklistRoomInfoStore'; +import useRoomInfoValidated from '@/hooks/useRoomInfoValidated'; const RealEstate = () => { - const actions = useStore(checklistRoomInfoStore, state => state.actions); - const realEstate = useStore(checklistRoomInfoStore, state => state.rawValue.realEstate); - const errorMessage = useStore(checklistRoomInfoStore, state => state.errorMessage.realEstate); + const realEstate = useRoomInfoValidated('realEstate'); return ( @@ -15,12 +11,12 @@ const RealEstate = () => { placeholder="" width="full" type={'string'} - onChange={actions.onChange} + onChange={realEstate.onChange} name={'realEstate'} - value={realEstate} + value={realEstate.rawValue} id="realEstate" /> - + ); }; diff --git a/frontend/src/components/NewChecklist/NewRoomInfoForm/RoomContractTerm.tsx b/frontend/src/components/NewChecklist/NewRoomInfoForm/RoomContractTerm.tsx index 843e08204..84e335fcd 100644 --- a/frontend/src/components/NewChecklist/NewRoomInfoForm/RoomContractTerm.tsx +++ b/frontend/src/components/NewChecklist/NewRoomInfoForm/RoomContractTerm.tsx @@ -1,15 +1,12 @@ import styled from '@emotion/styled'; -import { useStore } from 'zustand'; import FormField from '@/components/_common/FormField/FormField'; import Input from '@/components/_common/Input/Input'; import FormStyled from '@/components/NewChecklist/NewRoomInfoForm/styled'; -import checklistRoomInfoStore from '@/store/checklistRoomInfoStore'; +import useRoomInfoValidated from '@/hooks/useRoomInfoValidated'; const RoomContractTerm = () => { - const actions = useStore(checklistRoomInfoStore, state => state.actions); - const contractTerm = useStore(checklistRoomInfoStore, state => state.rawValue.contractTerm); - const errorMessage = useStore(checklistRoomInfoStore, state => state.errorMessage.contractTerm); + const contractTerm = useRoomInfoValidated('contractTerm'); return ( @@ -18,14 +15,14 @@ const RoomContractTerm = () => { - + ); }; diff --git a/frontend/src/components/NewChecklist/NewRoomInfoForm/RoomFloor.tsx b/frontend/src/components/NewChecklist/NewRoomInfoForm/RoomFloor.tsx index 8021d6ad6..25caadd23 100644 --- a/frontend/src/components/NewChecklist/NewRoomInfoForm/RoomFloor.tsx +++ b/frontend/src/components/NewChecklist/NewRoomInfoForm/RoomFloor.tsx @@ -1,22 +1,18 @@ -import { useStore } from 'zustand'; - import Dropdown from '@/components/_common/Dropdown/Dropdown'; import FormField from '@/components/_common/FormField/FormField'; import Input from '@/components/_common/Input/Input'; import FormStyled from '@/components/NewChecklist/NewRoomInfoForm/styled'; import { roomFloorLevels } from '@/constants/roomInfo'; -import checklistRoomInfoStore from '@/store/checklistRoomInfoStore'; +import useRoomInfoValidated from '@/hooks/useRoomInfoValidated'; const RoomFloor = () => { - const actions = useStore(checklistRoomInfoStore, state => state.actions); - const floor = useStore(checklistRoomInfoStore, state => state.rawValue.floor); - const floorLevel = useStore(checklistRoomInfoStore, state => state.rawValue.floorLevel); - const errorMessageFloor = useStore(checklistRoomInfoStore, state => state.errorMessage.floor); + const floor = useRoomInfoValidated('floor'); + const floorLevel = useRoomInfoValidated('floorLevel'); const handleClickDropdown = (level: string) => { - actions.set('floorLevel', level); + floorLevel.set(level); if (level === '반지하/지하') { - actions.set('floor', ''); + floor.set(''); } }; return ( @@ -24,22 +20,22 @@ const RoomFloor = () => { ({ value }))} onSelectSetter={handleClickDropdown} /> - + ); }; diff --git a/frontend/src/components/NewChecklist/NewRoomInfoForm/RoomName.tsx b/frontend/src/components/NewChecklist/NewRoomInfoForm/RoomName.tsx index 8188a1bb2..7c0b622d8 100644 --- a/frontend/src/components/NewChecklist/NewRoomInfoForm/RoomName.tsx +++ b/frontend/src/components/NewChecklist/NewRoomInfoForm/RoomName.tsx @@ -1,21 +1,24 @@ import React from 'react'; -import { useStore } from 'zustand'; import FormField from '@/components/_common/FormField/FormField'; import useDefaultRoomName from '@/components/NewChecklist/NewRoomInfoForm/useDefaultRoomName'; -import checklistRoomInfoStore from '@/store/checklistRoomInfoStore'; +import useRoomInfoValidated from '@/hooks/useRoomInfoValidated'; const RoomName = () => { + const roomName = useRoomInfoValidated('roomName'); useDefaultRoomName(); - const actions = useStore(checklistRoomInfoStore, state => state.actions); - const roomName = useStore(checklistRoomInfoStore, state => state.rawValue.roomName); - const errorMessage = useStore(checklistRoomInfoStore, state => state.errorMessage.roomName); return ( - - + + ); }; diff --git a/frontend/src/components/NewChecklist/NewRoomInfoForm/RoomNameNoDefault.tsx b/frontend/src/components/NewChecklist/NewRoomInfoForm/RoomNameNoDefault.tsx index f449e20b1..a697a1337 100644 --- a/frontend/src/components/NewChecklist/NewRoomInfoForm/RoomNameNoDefault.tsx +++ b/frontend/src/components/NewChecklist/NewRoomInfoForm/RoomNameNoDefault.tsx @@ -1,19 +1,22 @@ import React from 'react'; -import { useStore } from 'zustand'; import FormField from '@/components/_common/FormField/FormField'; -import checklistRoomInfoStore from '@/store/checklistRoomInfoStore'; +import useRoomInfoValidated from '@/hooks/useRoomInfoValidated'; const RoomNameNoDefault = () => { - const actions = useStore(checklistRoomInfoStore, state => state.actions); - const roomName = useStore(checklistRoomInfoStore, state => state.rawValue.roomName); - const errorMessage = useStore(checklistRoomInfoStore, state => state.errorMessage.roomName); + const roomName = useRoomInfoValidated('roomName'); return ( - - + + ); }; diff --git a/frontend/src/components/NewChecklist/NewRoomInfoForm/RoomSize.tsx b/frontend/src/components/NewChecklist/NewRoomInfoForm/RoomSize.tsx index 6a5f97a94..0d85a8f13 100644 --- a/frontend/src/components/NewChecklist/NewRoomInfoForm/RoomSize.tsx +++ b/frontend/src/components/NewChecklist/NewRoomInfoForm/RoomSize.tsx @@ -1,23 +1,26 @@ -import { useStore } from 'zustand'; - import FormField from '@/components/_common/FormField/FormField'; import Input from '@/components/_common/Input/Input'; import FormStyled from '@/components/NewChecklist/NewRoomInfoForm/styled'; -import checklistRoomInfoStore from '@/store/checklistRoomInfoStore'; +import useRoomInfoValidated from '@/hooks/useRoomInfoValidated'; const RoomSize = () => { - const actions = useStore(checklistRoomInfoStore, state => state.actions); - const roomSize = useStore(checklistRoomInfoStore, state => state.rawValue.size); - const errorMessage = useStore(checklistRoomInfoStore, state => state.errorMessage.size); + const roomSize = useRoomInfoValidated('size'); return ( - + - + ); }; diff --git a/frontend/src/components/NewChecklist/NewRoomInfoForm/RoomStructure.tsx b/frontend/src/components/NewChecklist/NewRoomInfoForm/RoomStructure.tsx index 370b454b3..ff46171e5 100644 --- a/frontend/src/components/NewChecklist/NewRoomInfoForm/RoomStructure.tsx +++ b/frontend/src/components/NewChecklist/NewRoomInfoForm/RoomStructure.tsx @@ -1,23 +1,18 @@ import { useCallback } from 'react'; -import { useStore } from 'zustand'; import Badge from '@/components/_common/Badge/Badge'; import FlexBox from '@/components/_common/FlexBox/FlexBox'; import FormField from '@/components/_common/FormField/FormField'; import FormStyled from '@/components/NewChecklist/NewRoomInfoForm/styled'; import { roomStructures } from '@/constants/roomInfo'; -import checklistRoomInfoStore from '@/store/checklistRoomInfoStore'; +import useRoomInfoValidated from '@/hooks/useRoomInfoValidated'; const RoomStructure = () => { - const actions = useStore(checklistRoomInfoStore, state => state.actions); - const roomStructure = useStore(checklistRoomInfoStore, state => state.rawValue.structure); + const roomStructure = useRoomInfoValidated('structure'); - const handleClickTagButton = useCallback( - (value: string) => { - actions.set('structure', value); - }, - [actions], - ); + const handleClickTagButton = useCallback((value: string) => { + roomStructure.set(value); + }, []); return ( @@ -29,7 +24,7 @@ const RoomStructure = () => { label={structure} name={structure} size="button" - isSelected={structure === roomStructure} + isSelected={structure === roomStructure.rawValue} onClick={() => handleClickTagButton(structure)} /> diff --git a/frontend/src/components/NewChecklist/NewRoomInfoForm/useDefaultRoomName.ts b/frontend/src/components/NewChecklist/NewRoomInfoForm/useDefaultRoomName.ts index 6faaf9853..9c90b4cdc 100644 --- a/frontend/src/components/NewChecklist/NewRoomInfoForm/useDefaultRoomName.ts +++ b/frontend/src/components/NewChecklist/NewRoomInfoForm/useDefaultRoomName.ts @@ -1,12 +1,11 @@ import { useEffect } from 'react'; -import { useStore } from 'zustand'; import useGetChecklistListQuery from '@/hooks/query/useGetChecklistListQuery'; -import checklistRoomInfoStore, { initialRoomInfo } from '@/store/checklistRoomInfoStore'; +import useRoomInfoValidated from '@/hooks/useRoomInfoValidated'; +import { initialRoomInfo } from '@/store/roomInfoStore'; const useDefaultRoomName = () => { - const roomInfoActions = useStore(checklistRoomInfoStore, state => state.actions); - const roomName = useStore(checklistRoomInfoStore, state => state.rawValue.roomName); + const roomName = useRoomInfoValidated('roomName'); const { data: checklistList } = useGetChecklistListQuery(); @@ -20,21 +19,10 @@ const useDefaultRoomName = () => { ).length; const date = new Date(); - roomInfoActions.set('roomName', `${date.getMonth() + 1}월 ${date.getDate()}일 ${count}번째 방`); + roomName.set(`${date.getMonth() + 1}월 ${date.getDate()}일 ${count}번째 방`); }, [checklistList]); - // 그이후부터는 폼은 안건드리고, 내부 value에만 적용 - useEffect(() => { - if (!checklistList) return; - if (roomName !== initialRoomInfo.roomName) return; - - const count = checklistList.filter( - checklist => new Date(checklist.createdAt).getUTCDay() === new Date().getUTCDay(), - ).length; - - const date = new Date(); - roomInfoActions.setValueForced('roomName', `${date.getMonth() + 1}월 ${date.getDate()}일 ${count}번째 방`); - }, [checklistList, roomName]); + // value를 직접건드려서 N번째방 value 넣어주던 로직지웠음. }; export default useDefaultRoomName; diff --git a/frontend/src/components/NewChecklist/SubmitModalWithSummary/SubmitModalWithSummary.tsx b/frontend/src/components/NewChecklist/SubmitModalWithSummary/SubmitModalWithSummary.tsx index 42cf4ed19..595c34f3d 100644 --- a/frontend/src/components/NewChecklist/SubmitModalWithSummary/SubmitModalWithSummary.tsx +++ b/frontend/src/components/NewChecklist/SubmitModalWithSummary/SubmitModalWithSummary.tsx @@ -1,5 +1,4 @@ import styled from '@emotion/styled'; -import { useStore } from 'zustand'; import Button from '@/components/_common/Button/Button'; import CounterBox from '@/components/_common/CounterBox/CounterBox'; @@ -7,7 +6,7 @@ import FormField from '@/components/_common/FormField/FormField'; import Modal from '@/components/_common/Modal/Modal'; import { MODAL_MESSAGE } from '@/constants/message'; import useMutateChecklist from '@/hooks/useMutateChecklist'; -import checklistRoomInfoStore from '@/store/checklistRoomInfoStore'; +import useRoomInfoValidated from '@/hooks/useRoomInfoValidated'; import { flexColumn, title3 } from '@/styles/common'; import { MutateType } from '@/types/checklist'; @@ -28,8 +27,7 @@ const SubmitModalWithSummary = ({ mutateType, checklistId, }: Props) => { - const summary = useStore(checklistRoomInfoStore, state => state.rawValue.summary); - const actions = useStore(checklistRoomInfoStore, state => state.actions); + const summary = useRoomInfoValidated('summary'); // 체크리스트 작성 / 수정 const { handleSubmitChecklist } = useMutateChecklist( @@ -63,14 +61,14 @@ const SubmitModalWithSummary = ({ - +