From ec91cdd8c99cf7f46466b01e1e7a461b586edb82 Mon Sep 17 00:00:00 2001 From: Sam Carlton Date: Tue, 3 May 2022 16:02:57 -0500 Subject: [PATCH] Use getPathPartsFromAstroRequest on app listing --- src/pages/app/[...appPath].astro | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/pages/app/[...appPath].astro b/src/pages/app/[...appPath].astro index 404d84d..9bee525 100644 --- a/src/pages/app/[...appPath].astro +++ b/src/pages/app/[...appPath].astro @@ -5,6 +5,7 @@ import axios from 'axios' import { ListingDetails } from '~/helpers/listing-page.js' +import { getPathPartsFromAstroRequest } from '~/helpers/url.js' import Layout from '../../layouts/default.astro' import Listing from '../../components/default-listing.astro' @@ -14,13 +15,11 @@ import Listing from '../../components/default-listing.astro' // } = Astro.params -// Parse the request url -const requestUrl = new URL( Astro.request.url ) // Get type and slug from the request path // so that we don't have extra parts for // urls like /:type/:slug/benchmarks -const [ , pathType, pathSlug ] = requestUrl.pathname.split('/') +const [ pathType, pathSlug ] = getPathPartsFromAstroRequest( Astro.request ) // Create an empty API URL const apiUrl = new URL( import.meta.env.PUBLIC_API_DOMAIN )