diff --git a/src/tools/wifi-qr-code-generator/useQRCode.ts b/src/tools/wifi-qr-code-generator/useQRCode.ts index 118176d2..a9e41a7e 100644 --- a/src/tools/wifi-qr-code-generator/useQRCode.ts +++ b/src/tools/wifi-qr-code-generator/useQRCode.ts @@ -119,7 +119,7 @@ export function useWifiQRCode({ async () => { // @see https://github.com/zxing/zxing/wiki/Barcode-Contents#wi-fi-network-config-android-ios-11 // This is the full spec, there's quite a bit of logic to generate the string embeddedin the QR code. - text.value = getQrCodeText({ + const qrText = getQrCodeText({ ssid: get(ssid), password: get(password), encryption: get(encryption), @@ -129,8 +129,8 @@ export function useWifiQRCode({ eapIdentity: get(eapIdentity), eapPhase2Method: get(eapPhase2Method), }); - if (text.value) { - qrcode.value = await QRCode.toDataURL(get(text.value).trim(), { + if (qrText) { + qrcode.value = await QRCode.toDataURL(get(qrText).trim(), { color: { dark: get(foreground), light: get(background), @@ -139,6 +139,7 @@ export function useWifiQRCode({ errorCorrectionLevel: 'M', ...options, }); + text.value = qrText; } }, { immediate: true },