@ -2,6 +2,7 @@ import {
type Component ,
type Component ,
createSignal ,
createSignal ,
onMount ,
onMount ,
onCleanup ,
Show ,
Show ,
For ,
For ,
} from 'solid-js' ;
} from 'solid-js' ;
@ -83,6 +84,12 @@ const SynthesisDetail: Component = () => {
const [ sendingEmail , setSendingEmail ] = createSignal ( false ) ;
const [ sendingEmail , setSendingEmail ] = createSignal ( false ) ;
const [ emailSuccess , setEmailSuccess ] = createSignal ( false ) ;
const [ emailSuccess , setEmailSuccess ] = createSignal ( false ) ;
const [ emailError , setEmailError ] = createSignal < string | null > ( null ) ;
const [ emailError , setEmailError ] = createSignal < string | null > ( null ) ;
const [ emailTimer , setEmailTimer ] = createSignal < ReturnType < typeof setTimeout > | undefined > ( ) ;
onCleanup ( ( ) = > {
const t = emailTimer ( ) ;
if ( t ) clearTimeout ( t ) ;
} ) ;
// Export state
// Export state
const [ exportingMarkdown , setExportingMarkdown ] = createSignal ( false ) ;
const [ exportingMarkdown , setExportingMarkdown ] = createSignal ( false ) ;
@ -147,7 +154,7 @@ const SynthesisDetail: Component = () => {
try {
try {
await synthesesApi . sendEmail ( synth . id , email ( ) ) ;
await synthesesApi . sendEmail ( synth . id , email ( ) ) ;
setEmailSuccess ( true ) ;
setEmailSuccess ( true ) ;
set Timeout( ( ) = > setEmailSuccess ( false ) , 5000 ) ;
set EmailTimer( set Timeout( ( ) = > setEmailSuccess ( false ) , 5000 ) ) ;
} catch ( err ) {
} catch ( err ) {
if ( isApiError ( err ) ) {
if ( isApiError ( err ) ) {
setEmailError ( err . message ) ;
setEmailError ( err . message ) ;