SVG.js: wait for PAT

This commit is contained in:
martin-mfg
2025-10-16 10:12:56 +02:00
parent d152b2c4c1
commit 368ce67a92
+10 -1
View File
@@ -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();