diff options
| author | Lionel Karlen <45311125+LionelKarlen@users.noreply.github.com> | 2021-07-15 20:21:01 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-07-15 11:21:01 -0700 |
| commit | c6fb2f011505a3e1892e1fb24f4df850c55bb57d (patch) | |
| tree | 6f6a61b4d0ec1f7702e68e095142f4cf892d8ef7 /src/components | |
| parent | 011564fb19ada2854c7adcbbeb3a26a31d7b51ab (diff) | |
Add check for non-null network name (#52)
Diffstat (limited to 'src/components')
| -rw-r--r-- | src/components/Card.js | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/src/components/Card.js b/src/components/Card.js index 0011ca8..c301bbe 100644 --- a/src/components/Card.js +++ b/src/components/Card.js | |||
| @@ -29,15 +29,19 @@ export const Card = () => { | |||
| 29 | }; | 29 | }; |
| 30 | 30 | ||
| 31 | const onPrint = () => { | 31 | const onPrint = () => { |
| 32 | if (network.password.length < 8 && network.encryptionMode === 'WPA') { | 32 | if (network.ssid.length > 0) { |
| 33 | alert('Password must be at least 8 characters'); | 33 | if (network.password.length < 8 && network.encryptionMode === 'WPA') { |
| 34 | } else if ( | 34 | alert('Password must be at least 8 characters'); |
| 35 | network.password.length < 5 && | 35 | } else if ( |
| 36 | network.encryptionMode === 'WEP' | 36 | network.password.length < 5 && |
| 37 | ) { | 37 | network.encryptionMode === 'WEP' |
| 38 | alert('Password must be at least 5 characters'); | 38 | ) { |
| 39 | alert('Password must be at least 5 characters'); | ||
| 40 | } else { | ||
| 41 | window.print(); | ||
| 42 | } | ||
| 39 | } else { | 43 | } else { |
| 40 | window.print(); | 44 | alert('Network name cannot be empty'); |
| 41 | } | 45 | } |
| 42 | }; | 46 | }; |
| 43 | 47 | ||
