Use request path for api path

This commit is contained in:
Sam Carlton 2022-04-26 12:58:02 -05:00
parent 41d5b5ec70
commit b126ee12c0

View file

@ -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