mirror of
https://github.com/ThatGuySam/doesitarm.git
synced 2026-05-18 06:44:46 -07:00
Use getPathPartsFromAstroRequest on app listing
This commit is contained in:
parent
e34e661f86
commit
ec91cdd8c9
1 changed files with 2 additions and 3 deletions
|
|
@ -5,6 +5,7 @@
|
||||||
import axios from 'axios'
|
import axios from 'axios'
|
||||||
|
|
||||||
import { ListingDetails } from '~/helpers/listing-page.js'
|
import { ListingDetails } from '~/helpers/listing-page.js'
|
||||||
|
import { getPathPartsFromAstroRequest } from '~/helpers/url.js'
|
||||||
|
|
||||||
import Layout from '../../layouts/default.astro'
|
import Layout from '../../layouts/default.astro'
|
||||||
import Listing from '../../components/default-listing.astro'
|
import Listing from '../../components/default-listing.astro'
|
||||||
|
|
@ -14,13 +15,11 @@ import Listing from '../../components/default-listing.astro'
|
||||||
// } = Astro.params
|
// } = Astro.params
|
||||||
|
|
||||||
|
|
||||||
// Parse the request url
|
|
||||||
const requestUrl = new URL( Astro.request.url )
|
|
||||||
|
|
||||||
// Get type and slug from the request path
|
// Get type and slug from the request path
|
||||||
// so that we don't have extra parts for
|
// so that we don't have extra parts for
|
||||||
// urls like /:type/:slug/benchmarks
|
// urls like /:type/:slug/benchmarks
|
||||||
const [ , pathType, pathSlug ] = requestUrl.pathname.split('/')
|
const [ pathType, pathSlug ] = getPathPartsFromAstroRequest( Astro.request )
|
||||||
|
|
||||||
// Create an empty API URL
|
// Create an empty API URL
|
||||||
const apiUrl = new URL( import.meta.env.PUBLIC_API_DOMAIN )
|
const apiUrl = new URL( import.meta.env.PUBLIC_API_DOMAIN )
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue