From 368ce67a9282fd5f4356a82a507d69fd843ef24b Mon Sep 17 00:00:00 2001 From: martin-mfg <2026226+martin-mfg@users.noreply.github.com> Date: Thu, 16 Oct 2025 10:12:56 +0200 Subject: [PATCH] SVG.js: wait for PAT --- frontend/frontend/src/components/Card/SVG.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/frontend/frontend/src/components/Card/SVG.js b/frontend/frontend/src/components/Card/SVG.js index d611c9bc..2f871ff7 100644 --- a/frontend/frontend/src/components/Card/SVG.js +++ b/frontend/frontend/src/components/Card/SVG.js @@ -10,6 +10,14 @@ import 'react-loading-skeleton/dist/skeleton.css'; import { createMockReq, createMockRes } from '../../mock-http'; import { default as router } from '../../backend/.vercel/output/functions/api.func/router.js'; +const waitForPat = async (interval = 100) => { + while (true) { + const val = process?.env?.['PAT_1']; + if (val) return; + await new Promise((resolve) => setTimeout(resolve, interval)); + } +}; + const SvgInline = (props) => { const [svg, setSvg] = useState(null); const [loaded, setLoaded] = useState(false); @@ -25,7 +33,8 @@ const SvgInline = (props) => { }); const res = createMockRes(); - router(req, res) + waitForPat() + .then(() => router(req, res)) .then(() => { const body = res._getBody(); const status = res._getStatusCode();