adding 'la suite territoriale' specific gaufre button/endpoint
This commit is contained in:
18
website/src/pages/api/v1/services-local.json.ts
Normal file
18
website/src/pages/api/v1/services-local.json.ts
Normal file
@@ -0,0 +1,18 @@
|
||||
import type { APIContext } from "astro"
|
||||
import services from "@/data/services-local.json"
|
||||
|
||||
export async function GET({ url }: APIContext) {
|
||||
const response = new Response(
|
||||
JSON.stringify(
|
||||
services
|
||||
.filter(({ enabled }) => !!enabled)
|
||||
.map((service) => ({
|
||||
id: service.id,
|
||||
name: service.name,
|
||||
url: new URL(`/services/${service.id}`, url).toString(),
|
||||
})),
|
||||
),
|
||||
)
|
||||
response.headers.set("Content-Type", "application/json")
|
||||
return response
|
||||
}
|
||||
Reference in New Issue
Block a user