diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/components/Card.js | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/components/Card.js b/src/components/Card.js index 16f94a4..3394859 100644 --- a/src/components/Card.js +++ b/src/components/Card.js | |||
| @@ -24,6 +24,14 @@ export const Card = () => { | |||
| 24 | return escaped; | 24 | return escaped; |
| 25 | }; | 25 | }; |
| 26 | 26 | ||
| 27 | const onPrint = () => { | ||
| 28 | if (network.password.length < 8) { | ||
| 29 | alert('Password must be atleast 8 characters'); | ||
| 30 | } else { | ||
| 31 | window.print(); | ||
| 32 | } | ||
| 33 | }; | ||
| 34 | |||
| 27 | useEffect(() => { | 35 | useEffect(() => { |
| 28 | const ssid = escape(network.ssid); | 36 | const ssid = escape(network.ssid); |
| 29 | const password = escape(network.password); | 37 | const password = escape(network.password); |
| @@ -73,7 +81,7 @@ export const Card = () => { | |||
| 73 | </p> | 81 | </p> |
| 74 | </fieldset> | 82 | </fieldset> |
| 75 | <div className="print-btn"> | 83 | <div className="print-btn"> |
| 76 | <button onClick={window.print}>Print</button> | 84 | <button onClick={onPrint}>Print</button> |
| 77 | </div> | 85 | </div> |
| 78 | </div> | 86 | </div> |
| 79 | ); | 87 | ); |
