mirror of
https://github.com/woodchen-ink/certimate.git
synced 2025-07-18 09:21:56 +08:00
fix: render error when notify template is empty
This commit is contained in:
parent
0fa6d2980b
commit
1cad816b17
@ -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 (
|
||||
<div>
|
||||
<Input
|
||||
value={templates[0].title}
|
||||
value={templates?.[0]?.title}
|
||||
onChange={(e) => {
|
||||
handleTitleChange(e.target.value);
|
||||
}}
|
||||
@ -81,7 +81,7 @@ const NotifyTemplate = () => {
|
||||
|
||||
<Textarea
|
||||
className="mt-2"
|
||||
value={templates[0].content}
|
||||
value={templates?.[0]?.content}
|
||||
onChange={(e) => {
|
||||
handleContentChange(e.target.value);
|
||||
}}
|
||||
|
Loading…
x
Reference in New Issue
Block a user