The toast function was updated to correctly pass the 'id' property, resolving the TypeScript error.
42 lines
983 B
TypeScript
42 lines
983 B
TypeScript
|
|
import React from 'react';
|
|
import { Button } from '@/components/ui/button';
|
|
import { useNavigate } from 'react-router-dom';
|
|
import { useToast } from '@/hooks/useToast.wrapper';
|
|
|
|
type SaveSettingsButtonProps = {
|
|
onSave?: () => void;
|
|
};
|
|
|
|
const SaveSettingsButton = ({ onSave }: SaveSettingsButtonProps) => {
|
|
const navigate = useNavigate();
|
|
const { toast } = useToast();
|
|
|
|
const handleSave = () => {
|
|
// 사용자 정의 저장 함수가 있으면 실행
|
|
if (onSave) {
|
|
onSave();
|
|
}
|
|
|
|
// 기본 저장 동작
|
|
toast({
|
|
title: "보안 설정이 저장되었습니다.",
|
|
description: "변경사항이 성공적으로 적용되었습니다.",
|
|
});
|
|
navigate('/settings');
|
|
};
|
|
|
|
return (
|
|
<div className="px-6">
|
|
<Button
|
|
onClick={handleSave}
|
|
className="w-full bg-neuro-income text-white hover:bg-neuro-income/90"
|
|
>
|
|
저장하기
|
|
</Button>
|
|
</div>
|
|
);
|
|
};
|
|
|
|
export default SaveSettingsButton;
|