Skip to content

Commit

Permalink
리안 헤일리 리뷰반영
Browse files Browse the repository at this point in the history
  • Loading branch information
skiende74 committed Oct 16, 2024
1 parent e93c3e5 commit 2467e45
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 24 deletions.
2 changes: 2 additions & 0 deletions frontend/src/pages/NewChecklistPage.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { useNavigate } from 'react-router-dom';
import { useStore } from 'zustand';

import Button from '@/components/_common/Button/Button';
Expand All @@ -21,6 +22,7 @@ import useChecklistStore from '@/store/useChecklistStore';
import useSelectedOptionStore from '@/store/useSelectedOptionStore';

const NewChecklistPage = () => {
const navigate = useNavigate();
const { tabs } = useChecklistTabs();

const roomInfoActions = useStore(roomInfoStore, state => state.actions);
Expand Down
11 changes: 10 additions & 1 deletion frontend/src/store/roomInfoStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,12 @@ type NumberToString<T> = T extends number | string ? string : T;

type RoomInfoStoreState = Required<Omit<RoomInfo, 'createdAt'>>;

// TODO : API POST때 사용할 Mapper 함수 필요. structure(방구조: 처음에 null)
/** roomInfo 자료를 모두 담는 스토어입니다.
* rawValues: roomInfo 백엔드 스키마에 해당하는 자료를 모두 담을 수 있습니다. (다만 number 타입자료형만은 string으로 저장하고있습니다.)
* errorMessage: 기본값은 ''(에러없음) 입니다.
*
* 현재 구현상으로는 폼과 무관해서 안쓰더라도 errorMessage를 만들어줘야합니다.
*/
export const initialRoomInfo = {
roomName: { rawValue: '', errorMessage: '' },
deposit: { rawValue: '', errorMessage: '' },
Expand Down Expand Up @@ -52,6 +57,10 @@ interface RoomInfoActions {
getParsedValues: () => RoomInfo;
}

/**
* getParsedValues: store에 저장된 걸 백엔드에 POST하는 등 데이터가 필요할때 사용합니다.
* getRawValues: errorMessages말고 rawValues들만을 담은 객체를 반환합니다.
*/
export const roomInfoStore = createStore<RoomInfoState & { actions: RoomInfoActions }>()(
persist(
(set, get) => ({
Expand Down
23 changes: 0 additions & 23 deletions frontend/src/types/room.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,27 +26,4 @@ export type RoomInfo = Partial<{
includedMaintenances: number[]; // 관리비 포함항목
}>;

// export type RoomInfo0 = {
// roomName: string;
// deposit: number;
// rent: number;
// maintenanceFee: number;
// contractTerm: number;
// floorLevel: string;
// floor: number;
// station: string;
// walkingTime: number;
// realEstate: string;
// size: number;
// structure: string;
// occupancyMonth: number;
// occupancyPeriod: OccupancyPeriod;
// summary: string;
// memo: string;
// type: string;
// // createdAt?: string;
// address: string;
// buildingName: string;
// includedMaintenances: number[]; // 관리비 포함항목
// };
export type RoomInfoName = keyof RoomInfo;

0 comments on commit 2467e45

Please sign in to comment.