외부 커넥션 관리 ~ 테스트
This commit is contained in:
26
frontend/hooks/use-toast.ts
Normal file
26
frontend/hooks/use-toast.ts
Normal file
@@ -0,0 +1,26 @@
|
||||
import { toast as sonnerToast } from "sonner";
|
||||
|
||||
interface ToastOptions {
|
||||
title?: string;
|
||||
description?: string;
|
||||
variant?: "default" | "destructive";
|
||||
duration?: number;
|
||||
}
|
||||
|
||||
export const useToast = () => {
|
||||
const toast = ({ title, description, variant = "default", duration }: ToastOptions) => {
|
||||
if (variant === "destructive") {
|
||||
sonnerToast.error(title || "오류", {
|
||||
description,
|
||||
duration: duration || 4000,
|
||||
});
|
||||
} else {
|
||||
sonnerToast.success(title || "성공", {
|
||||
description,
|
||||
duration: duration || 4000,
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
return { toast };
|
||||
};
|
||||
Reference in New Issue
Block a user