Run prettier
This commit is contained in:
@@ -30,25 +30,28 @@ export const QrCode: FC<Props> = ({ data, className }) => {
|
|||||||
const [url, setUrl] = useState<string | null>(null);
|
const [url, setUrl] = useState<string | null>(null);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
let isCancelled = false;
|
let isCancelled = false;
|
||||||
|
|
||||||
toDataURL(data, { errorCorrectionLevel: "L" }).then((url) => {
|
toDataURL(data, { errorCorrectionLevel: "L" })
|
||||||
if (!isCancelled) {
|
.then((url) => {
|
||||||
setUrl(url);
|
if (!isCancelled) {
|
||||||
}
|
setUrl(url);
|
||||||
}).catch((reason) => {
|
}
|
||||||
if (!isCancelled) {
|
})
|
||||||
setUrl(null);
|
.catch((reason) => {
|
||||||
}
|
if (!isCancelled) {
|
||||||
});
|
setUrl(null);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
return (): void => { isCancelled = true; };
|
return (): void => {
|
||||||
|
isCancelled = true;
|
||||||
|
};
|
||||||
}, [data]);
|
}, [data]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={classNames(styles.qrCode, className)}>
|
<div className={classNames(styles.qrCode, className)}>
|
||||||
{url && <img src={url} alt={t("qr_code")} />}
|
{url && <img src={url} alt={t("qr_code")} />}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user