Skip to content

Commit

Permalink
refactor: optimize some codes (#238)
Browse files Browse the repository at this point in the history
  • Loading branch information
zonemeen committed Apr 12, 2022
1 parent 85539db commit 127feaa
Showing 1 changed file with 15 additions and 19 deletions.
34 changes: 15 additions & 19 deletions src/App.js
Expand Up @@ -49,26 +49,22 @@ function App() {
});
return;
}

if (settings.ssid.length > 0) {
if (settings.password.length < 8 && settings.encryptionMode === 'WPA') {
setErrors({
...errors,
passwordError: t('wifi.alert.password.length.8'),
});
} else if (
settings.password.length < 5 &&
settings.encryptionMode === 'WEP'
) {
setErrors({
...errors,
passwordError: t('wifi.alert.password.length.5'),
});
} else {
document.title = 'WiFi Card - ' + settings.ssid;
window.print();
}
if (settings.password.length < 8 && settings.encryptionMode === 'WPA') {
setErrors({
...errors,
passwordError: t('wifi.alert.password.length.8'),
});
return;
}
if (settings.password.length < 5 && settings.encryptionMode === 'WEP') {
setErrors({
...errors,
passwordError: t('wifi.alert.password.length.5'),
});
return;
}
document.title = 'WiFi Card - ' + settings.ssid;
window.print();
};

const onSSIDChange = (ssid) => {
Expand Down

0 comments on commit 127feaa

Please sign in to comment.