Fix: Resolve Toast Type Error

The toast function was updated to correctly pass the 'id' property, resolving the TypeScript error.
This commit is contained in:
gpt-engineer-app[bot]
2025-03-16 09:17:47 +00:00
parent 7b50054da4
commit f228410b83
9 changed files with 17 additions and 15 deletions

View File

@@ -7,7 +7,7 @@ import { Form, FormControl, FormField, FormItem, FormLabel, FormMessage } from '
import { useForm } from 'react-hook-form'; import { useForm } from 'react-hook-form';
import { z } from 'zod'; import { z } from 'zod';
import { zodResolver } from '@hookform/resolvers/zod'; import { zodResolver } from '@hookform/resolvers/zod';
import { useToast } from '@/hooks/use-toast'; import { useToast } from '@/hooks/useToast.wrapper';
import { AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogTitle, AlertDialogTrigger } from '@/components/ui/alert-dialog'; import { AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogTitle, AlertDialogTrigger } from '@/components/ui/alert-dialog';
const passwordFormSchema = z.object({ const passwordFormSchema = z.object({

View File

@@ -6,7 +6,7 @@ import { Form, FormControl, FormField, FormItem, FormLabel, FormMessage } from '
import { useForm } from 'react-hook-form'; import { useForm } from 'react-hook-form';
import { z } from 'zod'; import { z } from 'zod';
import { zodResolver } from '@hookform/resolvers/zod'; import { zodResolver } from '@hookform/resolvers/zod';
import { useToast } from '@/hooks/use-toast'; import { useToast } from '@/hooks/useToast.wrapper';
import { useNavigate } from 'react-router-dom'; import { useNavigate } from 'react-router-dom';
import { useAuth } from '@/contexts/auth'; import { useAuth } from '@/contexts/auth';

View File

@@ -2,7 +2,7 @@
import React from 'react'; import React from 'react';
import { Button } from '@/components/ui/button'; import { Button } from '@/components/ui/button';
import { useNavigate } from 'react-router-dom'; import { useNavigate } from 'react-router-dom';
import { useToast } from '@/hooks/use-toast'; import { useToast } from '@/hooks/useToast.wrapper';
type SaveSettingsButtonProps = { type SaveSettingsButtonProps = {
onSave?: () => void; onSave?: () => void;

View File

@@ -1,6 +1,6 @@
import React from 'react'; import React from 'react';
import { useToast } from '@/hooks/use-toast'; import { useToast } from '@/hooks/useToast.wrapper';
import SecuritySettingItem from './SecuritySettingItem'; import SecuritySettingItem from './SecuritySettingItem';
import { SecuritySetting } from './types'; import { SecuritySetting } from './types';

View File

@@ -2,7 +2,7 @@
import * as React from "react" import * as React from "react"
import { ToastProps } from "@/components/ui/toast" import { ToastProps } from "@/components/ui/toast"
import { useToast as useToastStore } from "@/components/ui/use-toast" import { useToastStore } from "@/components/ui/use-toast"
import { ToastActionElement } from "@/components/ui/toast" import { ToastActionElement } from "@/components/ui/toast"
// 기본 지속 시간 늘리기 (기존 3000ms → 3500ms) // 기본 지속 시간 늘리기 (기존 3000ms → 3500ms)
@@ -16,6 +16,7 @@ export type ToasterToast = ToastProps & {
description?: React.ReactNode; description?: React.ReactNode;
action?: React.ReactNode; action?: React.ReactNode;
duration?: number; // 지속 시간 추가 duration?: number; // 지속 시간 추가
variant?: "default" | "destructive"; // variant 속성 추가
}; };
const actionTypes = ['default', 'cancel'] as const const actionTypes = ['default', 'cancel'] as const
@@ -69,7 +70,7 @@ export const useToast = () => {
addToast, addToast,
updateToast, updateToast,
dismissToast, dismissToast,
toast: (props: ToasterToast) => addToast(props), // toast 속성 추가 toast: (props: Omit<ToasterToast, "id">) => addToast(props),
}; };
}; };

View File

@@ -5,7 +5,7 @@ import { useNavigate } from 'react-router-dom';
import { Button } from '@/components/ui/button'; import { Button } from '@/components/ui/button';
import { Switch } from '@/components/ui/switch'; import { Switch } from '@/components/ui/switch';
import { Label } from '@/components/ui/label'; import { Label } from '@/components/ui/label';
import { useToast } from '@/hooks/use-toast'; import { useToast } from '@/hooks/useToast.wrapper';
type NotificationSetting = { type NotificationSetting = {
id: string; id: string;

View File

@@ -3,18 +3,19 @@ import NavBar from '@/components/NavBar';
import { ArrowLeft, CreditCard, PlusCircle } from 'lucide-react'; import { ArrowLeft, CreditCard, PlusCircle } from 'lucide-react';
import { useNavigate } from 'react-router-dom'; import { useNavigate } from 'react-router-dom';
import { Button } from '@/components/ui/button'; import { Button } from '@/components/ui/button';
import { useToast } from '@/hooks/use-toast'; import { useToast } from '@/hooks/useToast.wrapper';
const PaymentMethods = () => { const PaymentMethods = () => {
const navigate = useNavigate(); const navigate = useNavigate();
const { const { toast } = useToast();
toast
} = useToast();
const handleAddPayment = () => { const handleAddPayment = () => {
toast({ toast({
title: "알림", title: "알림",
description: "이 결제 기능은 아직 지원하지 않습니다." description: "이 결제 기능은 아직 지원하지 않습니다."
}); });
}; };
return <div className="min-h-screen bg-neuro-background pb-24"> return <div className="min-h-screen bg-neuro-background pb-24">
<div className="max-w-md mx-auto px-6"> <div className="max-w-md mx-auto px-6">
{/* Header */} {/* Header */}
@@ -57,4 +58,5 @@ const PaymentMethods = () => {
<NavBar /> <NavBar />
</div>; </div>;
}; };
export default PaymentMethods;
export default PaymentMethods;

View File

@@ -1,4 +1,3 @@
import React from 'react'; import React from 'react';
import { useNavigate } from 'react-router-dom'; import { useNavigate } from 'react-router-dom';
import NavBar from '@/components/NavBar'; import NavBar from '@/components/NavBar';
@@ -6,7 +5,7 @@ import SyncSettings from '@/components/SyncSettings';
import { User, CreditCard, Bell, Lock, HelpCircle, LogOut, ChevronRight } from 'lucide-react'; import { User, CreditCard, Bell, Lock, HelpCircle, LogOut, ChevronRight } from 'lucide-react';
import { cn } from '@/lib/utils'; import { cn } from '@/lib/utils';
import { useAuth } from '@/contexts/auth'; import { useAuth } from '@/contexts/auth';
import { useToast } from '@/hooks/use-toast'; import { useToast } from '@/hooks/useToast.wrapper';
const SettingsOption = ({ const SettingsOption = ({
icon: Icon, icon: Icon,

View File

@@ -12,6 +12,6 @@ export const showAuthToast = (
toast({ toast({
title, title,
description, description,
...(variant === 'destructive' ? { variant: 'destructive' } : {}) variant
}); });
}; };