From 48c0afcaa63ec89e929eff4cf0d2f5e95226320a Mon Sep 17 00:00:00 2001 From: Sam Carlton Date: Mon, 25 Apr 2022 22:26:26 -0500 Subject: [PATCH] Add initial app endpoint --- src/pages/app/[slug].astro | 78 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 78 insertions(+) create mode 100644 src/pages/app/[slug].astro diff --git a/src/pages/app/[slug].astro b/src/pages/app/[slug].astro new file mode 100644 index 0000000..f3ea657 --- /dev/null +++ b/src/pages/app/[slug].astro @@ -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 + +--- + + { slug } +
+
+ { JSON.stringify( cookie ) } +
+
+ { JSON.stringify( appEntry ) } +