Skip to content

Commit d517d34

Browse files
committed
fix: 메서드 이름 오타 수정 및 옵셔널 체이닝 변수 수정
1 parent ca23396 commit d517d34

2 files changed

Lines changed: 8 additions & 8 deletions

File tree

components/plans/PlanSection.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import Card from '../home/Card';
1313
import TaskItem from './TaskItem';
1414
import InlineAddTaskForm from './InlineAddTaskForm';
1515
import {
16-
fecthPlanItems,
16+
fetchPlanItems,
1717
toggleItemStatus,
1818
PlanItem,
1919
addPlanItem,
@@ -50,7 +50,7 @@ export default function PlanSection({
5050

5151
try {
5252
setIsTasksLoading(true);
53-
const fetchedTasks = await fecthPlanItems(userId, planId);
53+
const fetchedTasks = await fetchPlanItems(userId, planId);
5454
setTasks(fetchedTasks);
5555
} catch (error) {
5656
console.error('하위 항목 로딩 실패:', error);
@@ -77,12 +77,12 @@ export default function PlanSection({
7777
await toggleItemStatus(userId, itemId, currentStatus);
7878

7979
// 데이터 최신화: DB 업데이트 후 목록을 다시 불러옵니다.
80-
const updatedTasks = await fecthPlanItems(userId, planId);
80+
const updatedTasks = await fetchPlanItems(userId, planId);
8181
setTasks(updatedTasks);
8282
} catch (error) {
8383
console.error('상태 변경 실패:', error);
8484
// 에러 시 원래대로 돌리거나 다시 불러오기
85-
const rolledBackTasks = await fecthPlanItems(userId, planId);
85+
const rolledBackTasks = await fetchPlanItems(userId, planId);
8686
setTasks(rolledBackTasks);
8787
}
8888
};
@@ -94,7 +94,7 @@ export default function PlanSection({
9494
await addPlanItem(userId, planId, text, deadline);
9595

9696
// 데이터 최신화: 추가 후 목록을 다시 불러옵니다.
97-
const updatedTasks = await fecthPlanItems(userId, planId);
97+
const updatedTasks = await fetchPlanItems(userId, planId);
9898
setTasks(updatedTasks);
9999

100100
setIsAddingTask(false); // 입력 폼 닫기

lib/planManageService.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,12 +53,12 @@ export const fetchPlans = async (uid: string): Promise<Plan[]> => {
5353
return snapshot.docs.map((doc) => ({
5454
id: doc.id,
5555
...doc.data(),
56-
createdAt: doc.data().createdAt.toDate(),
56+
createdAt: doc.data().createdAt?.toDate(),
5757
})) as Plan[];
5858
};
5959

6060
// 3. 특정 플랜의 모든 하위 항목 가져오기
61-
export const fecthPlanItems = async (
61+
export const fetchPlanItems = async (
6262
uid: string,
6363
planId: string
6464
): Promise<PlanItem[]> => {
@@ -80,7 +80,7 @@ export const fecthPlanItems = async (
8080
...data,
8181
// Firestore Timestamp를 JS Date로 변환
8282
createdAt: data.createdAt?.toDate(),
83-
deadline: data.deadline?.toDate() || undefined,
83+
deadline: data.deadline?.toDate(),
8484
};
8585
}) as PlanItem[];
8686
};

0 commit comments

Comments
 (0)