mirror of
https://github.com/ThatGuySam/doesitarm.git
synced 2026-05-18 06:44:46 -07:00
Build api url as URL instance
This commit is contained in:
parent
65ced880c4
commit
7d0c6b182a
1 changed files with 8 additions and 5 deletions
|
|
@ -34,21 +34,24 @@ const {
|
|||
} = Astro.params
|
||||
|
||||
|
||||
const apiUrl = `${ import.meta.env.PUBLIC_API_DOMAIN }/api/app/spotify.json`
|
||||
const apiUrl = new URL( import.meta.env.PUBLIC_API_DOMAIN )
|
||||
|
||||
apiUrl.pathname = `/api/${ Astro.site.pathname }.json`
|
||||
|
||||
|
||||
// Astro Request reference
|
||||
// https://docs.astro.build/en/reference/api-reference/#astrorequests
|
||||
|
||||
console.log('Astro.params', Astro.params )
|
||||
console.log('apiUrl', apiUrl )
|
||||
console.log('Astro.request', Object.keys( Astro.request ) )
|
||||
console.log('Astro.request.url', Astro.request.url )
|
||||
console.log('Astro.site.pathname', Astro.site.pathname )
|
||||
console.log('Astro.request', Astro.request )
|
||||
|
||||
const appEntry = await axios.get(apiUrl)
|
||||
const appEntry = await axios.get( apiUrl.toString() )
|
||||
.then( response => {
|
||||
console.log('response', response )
|
||||
return response.data
|
||||
// console.log( 'response', response )
|
||||
return response.data.data
|
||||
})
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue