Fix import error in BudgetContext
The BudgetContext.tsx file was throwing an error because it was trying to import `BudgetPeriod` from the wrong location. Changed the import path to correctly reference the `BudgetPeriod` type.
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
|
||||
import React, { createContext, useState, useContext, useEffect } from 'react';
|
||||
import { BudgetContextType, BudgetData, BudgetPeriod, Transaction, CategoryBudget } from './budget/types';
|
||||
import { BudgetContextType, BudgetData, Transaction, CategoryBudget } from './budget/types';
|
||||
import { loadTransactionsFromStorage, saveTransactionsToStorage } from '@/hooks/transactions/storageUtils';
|
||||
import { v4 as uuidv4 } from 'uuid';
|
||||
|
||||
@@ -16,7 +15,7 @@ export const BudgetProvider: React.FC<{ children: React.ReactNode }> = ({ childr
|
||||
weekly: { targetAmount: 0, spentAmount: 0, remainingAmount: 0 },
|
||||
monthly: { targetAmount: 0, spentAmount: 0, remainingAmount: 0 },
|
||||
});
|
||||
const [selectedTab, setSelectedTab] = useState<BudgetPeriod>('monthly');
|
||||
const [selectedTab, setSelectedTab] = useState<'daily' | 'weekly' | 'monthly'>('monthly');
|
||||
|
||||
useEffect(() => {
|
||||
const storedTransactions = loadTransactionsFromStorage();
|
||||
@@ -51,7 +50,7 @@ export const BudgetProvider: React.FC<{ children: React.ReactNode }> = ({ childr
|
||||
};
|
||||
|
||||
// 예산 목표 업데이트
|
||||
const handleBudgetGoalUpdate = (type: BudgetPeriod, amount: number, newCategoryBudgets?: Record<string, number>) => {
|
||||
const handleBudgetGoalUpdate = (type: 'daily' | 'weekly' | 'monthly', amount: number, newCategoryBudgets?: Record<string, number>) => {
|
||||
setBudgetData(prev => ({
|
||||
...prev,
|
||||
[type]: {
|
||||
@@ -159,7 +158,7 @@ export const useBudget = () => {
|
||||
return context;
|
||||
};
|
||||
|
||||
// types 내보내기
|
||||
// 타입 내보내기를 수정
|
||||
export type { BudgetContextType };
|
||||
export { BudgetPeriod } from './budget/types';
|
||||
export type { Transaction } from './budget/types';
|
||||
export { type BudgetPeriod } from './budget/types';
|
||||
|
||||
Reference in New Issue
Block a user