Skip to content

Commit

Permalink
Add check for non-null network name (#52)
Browse files Browse the repository at this point in the history
  • Loading branch information
LionelKarlen committed Jul 15, 2021
1 parent 011564f commit c6fb2f0
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions src/components/Card.js
Expand Up @@ -29,15 +29,19 @@ export const Card = () => {
};

const onPrint = () => {
if (network.password.length < 8 && network.encryptionMode === 'WPA') {
alert('Password must be at least 8 characters');
} else if (
network.password.length < 5 &&
network.encryptionMode === 'WEP'
) {
alert('Password must be at least 5 characters');
if (network.ssid.length > 0) {
if (network.password.length < 8 && network.encryptionMode === 'WPA') {
alert('Password must be at least 8 characters');
} else if (
network.password.length < 5 &&
network.encryptionMode === 'WEP'
) {
alert('Password must be at least 5 characters');
} else {
window.print();
}
} else {
window.print();
alert('Network name cannot be empty');
}
};

Expand Down

0 comments on commit c6fb2f0

Please sign in to comment.