diff --git a/ui/src/components/notify/NotifyTemplate.tsx b/ui/src/components/notify/NotifyTemplate.tsx index 1ca6bd63..03d3a433 100644 --- a/ui/src/components/notify/NotifyTemplate.tsx +++ b/ui/src/components/notify/NotifyTemplate.tsx @@ -28,7 +28,7 @@ const NotifyTemplate = () => { }, []); const handleTitleChange = (val: string) => { - const template = templates[0]; + const template = templates?.[0] ?? {}; setTemplates([ { @@ -39,7 +39,7 @@ const NotifyTemplate = () => { }; const handleContentChange = (val: string) => { - const template = templates[0]; + const template = templates?.[0] ?? {}; setTemplates([ { @@ -71,7 +71,7 @@ const NotifyTemplate = () => { return (
{ handleTitleChange(e.target.value); }} @@ -81,7 +81,7 @@ const NotifyTemplate = () => {