File tree Expand file tree Collapse file tree 1 file changed +8
-4
lines changed
Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -13,6 +13,8 @@ interface FooterStats {
1313 supportHours : string ;
1414}
1515
16+ const emailRegex = / ^ [ ^ \s @ ] + @ [ ^ \s @ ] + \. [ ^ \s @ ] + $ / ;
17+
1618export default function FooterLayout ( {
1719 style,
1820 links,
@@ -53,13 +55,12 @@ export default function FooterLayout({
5355
5456 fetchStats ( ) ;
5557 const interval = setInterval ( fetchStats , 30000 ) ; // Update every 30 seconds
56-
58+
5759 return ( ) => clearInterval ( interval ) ;
5860 } , [ ] ) ;
59-
61+
6062 const handleSubscribe = ( e : React . FormEvent ) => {
6163 e . preventDefault ( ) ;
62- const emailRegex = / ^ [ ^ \s @ ] + @ [ ^ \s @ ] + \. [ ^ \s @ ] + $ / ;
6364
6465 if ( ! email ) {
6566 setError ( "Email is required" ) ;
@@ -354,7 +355,10 @@ export default function FooterLayout({
354355355356 className = "newsletter-input"
356357 value = { email }
357- onChange = { ( e ) => setEmail ( e . target . value ) }
358+ onChange = { ( e ) => {
359+ setEmail ( e . target . value ) ;
360+ setError ( "" ) ;
361+ } }
358362 required
359363 />
360364 < button
You can’t perform that action at this time.
0 commit comments