29 lines
676 B
Plaintext
29 lines
676 B
Plaintext
---
|
|
import ElementView from '../../views/ElementView.astro';
|
|
import Layout from '../../layouts/Layout.astro';
|
|
|
|
import fetchApi from '../../lib/strapi';
|
|
import type PoleElement from '../../interfaces/poleElement';
|
|
|
|
const { id } = Astro.params;
|
|
|
|
let poleElement: PoleElement;
|
|
|
|
try {
|
|
poleElement = await fetchApi<PoleElement>({
|
|
endpoint: 'elements',
|
|
wrappedByKey: 'data',
|
|
wrappedByList: true,
|
|
query: {
|
|
'populate': '*',
|
|
'filters[id][$eq]': id || '',
|
|
},
|
|
});
|
|
} catch (error) {
|
|
return Astro.redirect('/404');
|
|
}
|
|
|
|
---
|
|
<Layout title={poleElement.name} description={poleElement.description}>
|
|
<ElementView entry={{ data: poleElement }} />
|
|
</Layout> |