Add initial app endpoint

This commit is contained in:
Sam Carlton 2022-04-25 22:26:26 -05:00
parent c1991e5f2a
commit 48c0afcaa6

View file

@ -0,0 +1,78 @@
---
// Full Astro Component Syntax:
// https://docs.astro.build/core-concepts/astro-components/
import axios from 'axios'
import Layout from '../../layouts/default.astro'
import { makeLastUpdatedFriendly } from '~/helpers/parse-date'
import { getAppEndpoint } from '~/helpers/app-derived.js'
import LinkButton from '~/components/link-button.vue'
import AllUpdatesSubscribe from '~/components/all-updates-subscribe.vue'
import VideoRow from '~/components/video/row.vue'
import appList from '~/static/app-list.json'
// export async function getStaticPaths () {
// return appList.map(app => {
// // console.log('app.slug', app.slug )
// return {
// params: {
// slug: app.slug
// }
// }
// })
// }
const {
slug
} = Astro.params
const apiUrl = `${ import.meta.env.API_DOMAIN }/api/app/spotify.json`
const cookie = Astro.request.headers.get('cookie')
console.log('Astro.params', Astro.params )
console.log('apiUrl', apiUrl )
console.log('cookie', cookie )
const appEntry = await axios.get(apiUrl)
.then( response => {
console.log('response', response )
return response.data
})
// const {
// head,
// entry
// } = Astro.props
const app = {}
const hasMultipleAliases = false
const appDeviceSupport = []
const hasRelatedVideos = false
const relatedVideosRowHtml = []
const hasBundleIdentifiers = false
const lastUpdatedFriendly = null
---
<Layout
headTitle={ `${ appEntry.name } | Does It ARM` }
headDescription={ 'Test' }
>
{ slug }
<br>
<br>
{ JSON.stringify( cookie ) }
<br>
<br>
{ JSON.stringify( appEntry ) }
</Layout>