Fix TypeScript errors

Fixes TypeScript errors related to missing properties and incorrect exports.
This commit is contained in:
gpt-engineer-app[bot]
2025-03-22 07:12:06 +00:00
parent aa8381a823
commit 81afd624a4
7 changed files with 31 additions and 8 deletions

View File

@@ -1,3 +1,4 @@
import React, { createContext, useState, useContext, useEffect } from 'react';
import { BudgetContextType, BudgetData, BudgetPeriod, Transaction, CategoryBudget } from './budget/types';
import { loadTransactionsFromStorage, saveTransactionsToStorage } from '@/hooks/transactions/storageUtils';
@@ -118,6 +119,16 @@ export const BudgetProvider: React.FC<{ children: React.ReactNode }> = ({ childr
return result;
};
// 예산 데이터 재설정 함수 추가
const resetBudgetData = () => {
setBudgetData({
daily: { targetAmount: 0, spentAmount: 0, remainingAmount: 0 },
weekly: { targetAmount: 0, spentAmount: 0, remainingAmount: 0 },
monthly: { targetAmount: 0, spentAmount: 0, remainingAmount: 0 },
});
setCategoryBudgets({});
};
return (
<BudgetContext.Provider value={{
@@ -126,12 +137,13 @@ export const BudgetProvider: React.FC<{ children: React.ReactNode }> = ({ childr
budgetData,
selectedTab,
setSelectedTab,
addTransaction,
updateTransaction,
deleteTransaction,
handleBudgetGoalUpdate,
getCategorySpending,
getPaymentMethodStats, // 추가된 메서드
addTransaction,
deleteTransaction,
getPaymentMethodStats,
resetBudgetData,
}}>
{children}
</BudgetContext.Provider>
@@ -146,3 +158,8 @@ export const useBudget = () => {
}
return context;
};
// types 내보내기
export type { BudgetContextType };
export { BudgetPeriod } from './budget/types';
export type { Transaction } from './budget/types';