Fix budget display and button
- Fix the budget display issue where monthly budgets were showing four amounts instead of one. - Resolve the functionality of the "Edit Budget" button.
This commit is contained in:
@@ -15,6 +15,8 @@ export const useExtendedBudgetUpdate = (
|
||||
amount: number,
|
||||
newCategoryBudgets?: Record<string, number>
|
||||
) => {
|
||||
console.log('확장 예산 업데이트 시작:', type, amount, newCategoryBudgets);
|
||||
|
||||
// 기본 예산 목표 업데이트
|
||||
handleBudgetUpdate(type, amount);
|
||||
|
||||
@@ -22,7 +24,17 @@ export const useExtendedBudgetUpdate = (
|
||||
if (newCategoryBudgets) {
|
||||
console.log('카테고리 예산 업데이트:', newCategoryBudgets);
|
||||
setCategoryBudgets(newCategoryBudgets);
|
||||
|
||||
// 카테고리 예산 업데이트 이벤트 발생
|
||||
setTimeout(() => {
|
||||
window.dispatchEvent(new Event('categoryBudgetsUpdated'));
|
||||
}, 100);
|
||||
}
|
||||
|
||||
// 모든 업데이트가 완료된 후 전역 예산 데이터 업데이트 이벤트 발생
|
||||
setTimeout(() => {
|
||||
window.dispatchEvent(new Event('budgetDataUpdated'));
|
||||
}, 200);
|
||||
};
|
||||
|
||||
return extendedBudgetUpdate;
|
||||
|
||||
Reference in New Issue
Block a user