mirror of https://github.com/usual2970/certimate
fix: render error when notify template is empty
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…
Reference in New Issue