diff --git a/frontend/src/app/qr-code-generator/page.tsx b/frontend/src/app/qr-code-generator/page.tsx index 0b2a82b..c179264 100644 --- a/frontend/src/app/qr-code-generator/page.tsx +++ b/frontend/src/app/qr-code-generator/page.tsx @@ -7,7 +7,7 @@ import Image from "next/image"; export default function QrCodeGenerator() { const [loading, setLoading] = useState(false); - const [qrcode, setQRCode] = useState(null); + const [QRCodeURL, setQRCodeURL] = useState(null); const downloadImage = (dataUrl: string) => { const link = document.createElement("a"); @@ -33,7 +33,7 @@ export default function QrCodeGenerator() { "Content-Type": "application/json", }, body: JSON.stringify({ - data: textInput, + qrcodeContent: textInput, }), }, ); @@ -43,9 +43,8 @@ export default function QrCodeGenerator() { } const data = await response.json(); - console.log("Data:", data); if (data.qrCode) { - setQRCode(data.qrCode); + setQRCodeURL(data.qrCode); downloadImage(data.qrCode); } } catch (error) { @@ -56,6 +55,12 @@ export default function QrCodeGenerator() { } }; + function clearInputAndQRCode() { + setQRCodeURL(""); + const data = document.getElementById("data") as HTMLInputElement; + data.value = ""; + } + return (
@@ -82,14 +87,16 @@ export default function QrCodeGenerator() { } onClick={generateQRCode} /> +
- {qrcode && ( + {QRCodeURL && ( QR Code )}