mirror of
https://github.com/woodchen-ink/certimate.git
synced 2025-07-18 17:31:55 +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 handleTitleChange = (val: string) => {
|
||||||
const template = templates[0];
|
const template = templates?.[0] ?? {};
|
||||||
|
|
||||||
setTemplates([
|
setTemplates([
|
||||||
{
|
{
|
||||||
@ -39,7 +39,7 @@ const NotifyTemplate = () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const handleContentChange = (val: string) => {
|
const handleContentChange = (val: string) => {
|
||||||
const template = templates[0];
|
const template = templates?.[0] ?? {};
|
||||||
|
|
||||||
setTemplates([
|
setTemplates([
|
||||||
{
|
{
|
||||||
@ -71,7 +71,7 @@ const NotifyTemplate = () => {
|
|||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<Input
|
<Input
|
||||||
value={templates[0].title}
|
value={templates?.[0]?.title}
|
||||||
onChange={(e) => {
|
onChange={(e) => {
|
||||||
handleTitleChange(e.target.value);
|
handleTitleChange(e.target.value);
|
||||||
}}
|
}}
|
||||||
@ -81,7 +81,7 @@ const NotifyTemplate = () => {
|
|||||||
|
|
||||||
<Textarea
|
<Textarea
|
||||||
className="mt-2"
|
className="mt-2"
|
||||||
value={templates[0].content}
|
value={templates?.[0]?.content}
|
||||||
onChange={(e) => {
|
onChange={(e) => {
|
||||||
handleContentChange(e.target.value);
|
handleContentChange(e.target.value);
|
||||||
}}
|
}}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user