From e0138cbede239fe6ab62442c9c92e9bb13875aaf Mon Sep 17 00:00:00 2001 From: Opliko Date: Thu, 28 Mar 2024 11:53:49 +0100 Subject: [PATCH] feat: follow redirects in API --- public/src/modules/api.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/public/src/modules/api.js b/public/src/modules/api.js index f510586549..95d5d35a1e 100644 --- a/public/src/modules/api.js +++ b/public/src/modules/api.js @@ -61,6 +61,11 @@ async function xhr(options) { const res = await fetch(url, options); const { headers } = res; + + if (headers.get('x-redirect')) { + return xhr({ url: headers.get('x-redirect'), ...options }); + } + const contentType = headers.get('content-type'); const isJSON = contentType && contentType.startsWith('application/json');