MCPcopy
hub / github.com/bndw/wifi-card / onPrint

Function onPrint

src/App.js:48–92  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

46 };
47
48 const onPrint = () => {
49 if (!settings.ssid.length) {
50 setErrors({
51 ...errors,
52 ssidError: t('wifi.alert.name'),
53 });
54 return;
55 }
56 if (settings.password.length < 8 && settings.encryptionMode === 'WPA') {
57 setErrors({
58 ...errors,
59 passwordError: t('wifi.alert.password.length.8'),
60 });
61 return;
62 }
63 if (settings.password.length < 5 && settings.encryptionMode === 'WEP') {
64 setErrors({
65 ...errors,
66 passwordError: t('wifi.alert.password.length.5'),
67 });
68 return;
69 }
70 if (
71 settings.password.length < 1 &&
72 settings.encryptionMode === 'WPA2-EAP'
73 ) {
74 setErrors({
75 ...errors,
76 passwordError: t('wifi.alert.password'),
77 });
78 return;
79 }
80 if (
81 settings.eapIdentity.length < 1 &&
82 settings.encryptionMode === 'WPA2-EAP'
83 ) {
84 setErrors({
85 ...errors,
86 eapIdentityError: t('wifi.alert.eapIdentity'),
87 });
88 return;
89 }
90 document.title = 'WiFi Card - ' + settings.ssid;
91 window.print();
92 };
93
94 const onSSIDChange = (ssid) => {
95 setErrors({ ...errors, ssidError: '' });

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected