From 34aaddfc538bb3e30ffef45b7de8df1c44daf0a2 Mon Sep 17 00:00:00 2001 From: NSUWAL123 Date: Fri, 27 Sep 2024 13:14:01 +0545 Subject: [PATCH] fix(files): cleanup function remove --- src/frontend/src/api/Files.ts | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/src/frontend/src/api/Files.ts b/src/frontend/src/api/Files.ts index 79e69b4686..f130f68186 100755 --- a/src/frontend/src/api/Files.ts +++ b/src/frontend/src/api/Files.ts @@ -16,13 +16,14 @@ export const GetProjectQrCode = ( osmUser: string, ): { qrcode: string } => { const [qrcode, setQrcode] = useState(''); + useEffect(() => { const fetchProjectFileById = async ( odkToken: string | undefined, projectName: string | undefined, osmUser: string, ) => { - if (odkToken === '') { + if (!odkToken || !projectName) { setQrcode(''); return; } @@ -46,18 +47,11 @@ export const GetProjectQrCode = ( // Note: pako.deflate zlib encodes to content code.addData(base64zlibencode(odkCollectJson)); code.make(); - // Note: cell size = 3, margin = 5 setQrcode(code.createDataURL(3, 5)); }; fetchProjectFileById(odkToken, projectName, osmUser); - - const cleanUp = () => { - setQrcode(''); - }; - - return cleanUp; }, [projectName, odkToken, osmUser]); return { qrcode }; };