blog
parent
0f3ef215c3
commit
0c21c1bc6b
|
@ -1,19 +1,21 @@
|
|||
---
|
||||
const response = await fetch('https://curriculum-app-api.beanstalkedu.com/items/blog/1');
|
||||
const data = await response.json();
|
||||
const blog = data.data;
|
||||
console.log(blog)
|
||||
|
||||
export function getStaticPaths() {
|
||||
return [
|
||||
{ params: { id: '1' } },
|
||||
{ params: { id: '2' } },
|
||||
{ params: { id: '3' } }
|
||||
];
|
||||
const response = await fetch('https://curriculum-app-api.beanstalkedu.com/items/blog');
|
||||
const data = await response.json();
|
||||
export async function getStaticPaths() {
|
||||
const response = await fetch('https://curriculum-app-api.beanstalkedu.com/items/blog');
|
||||
const data = await response.json();
|
||||
const finalData = data.data.map((n: { slug: any; })=>{
|
||||
return {params: {id:n.slug}}
|
||||
})
|
||||
console.log(finalData)
|
||||
return finalData;
|
||||
}
|
||||
|
||||
const { id } = Astro.params;
|
||||
const idx = data.data.findIndex(n => n.slug ===id);
|
||||
---
|
||||
<h1>{id}</h1>
|
||||
<h1>{id}</h1>
|
||||
{blog}
|
||||
{data.data[idx].slug} <br>
|
||||
{data.data[idx].status} <br>
|
||||
{data.data[idx].title} <br>
|
||||
{data.data[idx].property} <br>
|
Loading…
Reference in New Issue