Fix: Ensure BudgetProvider usage
The `useBudget` hook was being called outside of the `BudgetProvider` context in the `Index` component. This commit ensures that the `Index` component and its children are wrapped with the `BudgetProvider` in `App.tsx` to resolve the error.
This commit is contained in:
@@ -15,7 +15,7 @@ import HelpSupport from './pages/HelpSupport';
|
|||||||
import Analytics from './pages/Analytics';
|
import Analytics from './pages/Analytics';
|
||||||
import Transactions from './pages/Transactions';
|
import Transactions from './pages/Transactions';
|
||||||
import { AuthProvider } from './contexts/auth';
|
import { AuthProvider } from './contexts/auth';
|
||||||
import { BudgetProvider } from './contexts/budget';
|
import { BudgetProvider } from './contexts/BudgetContext';
|
||||||
import { Toaster } from '@/components/ui/toaster';
|
import { Toaster } from '@/components/ui/toaster';
|
||||||
import { Toaster as SonnerToaster} from '@/components/ui/sonner';
|
import { Toaster as SonnerToaster} from '@/components/ui/sonner';
|
||||||
import SafeAreaContainer from './components/SafeAreaContainer';
|
import SafeAreaContainer from './components/SafeAreaContainer';
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
import { useState, useRef, useEffect } from 'react';
|
import { useState, useRef, useEffect } from 'react';
|
||||||
import { UseFormReturn, useForm } from 'react-hook-form';
|
import { UseFormReturn, useForm } from 'react-hook-form';
|
||||||
import { zodResolver } from '@hookform/resolvers/zod';
|
import { zodResolver } from '@hookform/resolvers/zod';
|
||||||
import { Transaction } from '@/components/TransactionCard';
|
import { Transaction } from '@/contexts/budget/types';
|
||||||
import { useBudget } from '@/contexts/BudgetContext';
|
import { useBudget } from '@/contexts/BudgetContext';
|
||||||
import { toast } from '@/components/ui/use-toast';
|
import { toast } from '@/components/ui/use-toast';
|
||||||
import { TransactionFormValues, transactionFormSchema, formatWithCommas } from './TransactionFormFields';
|
import { TransactionFormValues, transactionFormSchema, formatWithCommas } from './TransactionFormFields';
|
||||||
|
|||||||
@@ -20,4 +20,5 @@ export { useBudget } from './useBudget';
|
|||||||
export type { BudgetContextType } from './useBudget';
|
export type { BudgetContextType } from './useBudget';
|
||||||
|
|
||||||
// types.ts에서 타입들을 export
|
// types.ts에서 타입들을 export
|
||||||
export { BudgetPeriod, Transaction } from './types';
|
export { BudgetPeriod } from './types';
|
||||||
|
export type { Transaction } from './types';
|
||||||
|
|||||||
@@ -3,8 +3,7 @@ export * from './BudgetContext';
|
|||||||
export * from './budgetUtils';
|
export * from './budgetUtils';
|
||||||
export * from './storageUtils';
|
export * from './storageUtils';
|
||||||
|
|
||||||
// types.ts에서 BudgetPeriod와 다른 타입들을 내보내지만,
|
// types.ts에서 타입들을 내보냅니다
|
||||||
// BudgetContextType은 이미 BudgetContext에서 내보내고 있으므로 제외
|
|
||||||
export type {
|
export type {
|
||||||
BudgetPeriod,
|
BudgetPeriod,
|
||||||
BudgetPeriodData,
|
BudgetPeriodData,
|
||||||
|
|||||||
Reference in New Issue
Block a user