From b126ee12c0cc96ec2681c7a8a8e5eb3c57840273 Mon Sep 17 00:00:00 2001 From: Sam Carlton Date: Tue, 26 Apr 2022 12:58:02 -0500 Subject: [PATCH] Use request path for api path --- src/pages/app/[slug].astro | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/pages/app/[slug].astro b/src/pages/app/[slug].astro index 6b9f15e..1e7cb39 100644 --- a/src/pages/app/[slug].astro +++ b/src/pages/app/[slug].astro @@ -36,7 +36,11 @@ const { const apiUrl = new URL( import.meta.env.PUBLIC_API_DOMAIN ) -apiUrl.pathname = `/api/${ Astro.site.pathname }.json` +// Parse the request url +const requestUrl = new URL( Astro.request.url ) + +// Use request path to get api url path +apiUrl.pathname = `/api${ requestUrl.pathname }.json` // Astro Request reference