Skip to content

Commit 38ec3f7

Browse files
committed
Fix typecheck
1 parent 0fc30fe commit 38ec3f7

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/tools/wifi-qr-code-generator/useQRCode.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ export function useWifiQRCode({
119119
async () => {
120120
// @see https://github.com/zxing/zxing/wiki/Barcode-Contents#wi-fi-network-config-android-ios-11
121121
// This is the full spec, there's quite a bit of logic to generate the string embeddedin the QR code.
122-
text.value = getQrCodeText({
122+
const qrText = getQrCodeText({
123123
ssid: get(ssid),
124124
password: get(password),
125125
encryption: get(encryption),
@@ -129,8 +129,8 @@ export function useWifiQRCode({
129129
eapIdentity: get(eapIdentity),
130130
eapPhase2Method: get(eapPhase2Method),
131131
});
132-
if (text.value) {
133-
qrcode.value = await QRCode.toDataURL(get(text.value).trim(), {
132+
if (qrText) {
133+
qrcode.value = await QRCode.toDataURL(get(qrText).trim(), {
134134
color: {
135135
dark: get(foreground),
136136
light: get(background),
@@ -139,6 +139,7 @@ export function useWifiQRCode({
139139
errorCorrectionLevel: 'M',
140140
...options,
141141
});
142+
text.value = qrText;
142143
}
143144
},
144145
{ immediate: true },

0 commit comments

Comments
 (0)