mirror of
https://github.com/covidpass-org/covidpass.git
synced 2025-02-22 06:27:49 +01:00
Try to fix QR code viewer
This commit is contained in:
parent
d205444659
commit
7d930105d2
@ -13,6 +13,7 @@ function Pass(): JSX.Element {
|
|||||||
|
|
||||||
const [fragment, setFragment] = useState<string>(undefined);
|
const [fragment, setFragment] = useState<string>(undefined);
|
||||||
const [view, setView] = useState<boolean>(true);
|
const [view, setView] = useState<boolean>(true);
|
||||||
|
const [resized, setResized] = useState<boolean>(false);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const rawFragment = window.location.hash.substring(1);
|
const rawFragment = window.location.hash.substring(1);
|
||||||
@ -22,12 +23,13 @@ function Pass(): JSX.Element {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const resizeTimeout = window.setTimeout(() => {
|
const resizeTimeout = window.setTimeout(() => {
|
||||||
if (rawFragment) {
|
if (!resized && rawFragment) {
|
||||||
window.location.replace('/pass/note');
|
window.location.replace('/pass/note');
|
||||||
}
|
}
|
||||||
}, 100);
|
}, 100);
|
||||||
|
|
||||||
window.addEventListener('resize', () => {
|
window.addEventListener('resize', () => {
|
||||||
|
setResized(true);
|
||||||
clearTimeout(resizeTimeout);
|
clearTimeout(resizeTimeout);
|
||||||
const decodedFragment = Buffer.from(rawFragment, 'base64').toString();
|
const decodedFragment = Buffer.from(rawFragment, 'base64').toString();
|
||||||
setFragment(decodedFragment);
|
setFragment(decodedFragment);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user