Fix type error in AddTransactionButton
The type of the 'type' property in the newExpense object was incorrect, causing a TypeScript error. Changed the type to be explicitly 'expense' to match the Transaction type definition.
This commit is contained in:
@@ -7,6 +7,7 @@ import { useBudget } from '@/contexts/BudgetContext';
|
|||||||
import { supabase } from '@/lib/supabase';
|
import { supabase } from '@/lib/supabase';
|
||||||
import { isSyncEnabled } from '@/utils/syncUtils';
|
import { isSyncEnabled } from '@/utils/syncUtils';
|
||||||
import ExpenseForm, { ExpenseFormValues } from './expenses/ExpenseForm';
|
import ExpenseForm, { ExpenseFormValues } from './expenses/ExpenseForm';
|
||||||
|
import { Transaction } from '@/components/TransactionCard';
|
||||||
|
|
||||||
const AddTransactionButton = () => {
|
const AddTransactionButton = () => {
|
||||||
const [showExpenseDialog, setShowExpenseDialog] = useState(false);
|
const [showExpenseDialog, setShowExpenseDialog] = useState(false);
|
||||||
@@ -27,13 +28,13 @@ const AddTransactionButton = () => {
|
|||||||
const now = new Date();
|
const now = new Date();
|
||||||
const formattedDate = `오늘, ${now.getHours()}:${now.getMinutes() < 10 ? '0' + now.getMinutes() : now.getMinutes()} ${now.getHours() >= 12 ? 'PM' : 'AM'}`;
|
const formattedDate = `오늘, ${now.getHours()}:${now.getMinutes() < 10 ? '0' + now.getMinutes() : now.getMinutes()} ${now.getHours() >= 12 ? 'PM' : 'AM'}`;
|
||||||
|
|
||||||
const newExpense = {
|
const newExpense: Transaction = {
|
||||||
id: Date.now().toString(),
|
id: Date.now().toString(),
|
||||||
title: data.title,
|
title: data.title,
|
||||||
amount: parseInt(numericAmount),
|
amount: parseInt(numericAmount),
|
||||||
date: formattedDate,
|
date: formattedDate,
|
||||||
category: data.category,
|
category: data.category,
|
||||||
type: 'expense'
|
type: 'expense' // 명시적으로 'expense'로 설정
|
||||||
};
|
};
|
||||||
|
|
||||||
// BudgetContext를 통해 지출 추가
|
// BudgetContext를 통해 지출 추가
|
||||||
|
|||||||
Reference in New Issue
Block a user