type Datocms = {
apiKey: string
}
export async function main(resource: Datocms, recordId: string) {
const endpoint = `https://site-api.datocms.com/items/${recordId}`
const response = await fetch(endpoint, {
method: 'DELETE',
headers: {
Authorization: `Bearer ${resource.apiKey}`,
Accept: 'application/json',
'X-Api-Version': '3'
}
})
if (!response.ok) {
throw new Error(`HTTP error! status: ${response.status}`)
}
const data = await response.json()
return data
}
Submitted by hugo697 621 days ago