Use this method to delete a category.
1
//native
2
/**
3
* Delete Category
4
* Use this method to delete a category.
5
*/
6
export async function main(auth: RT.Mezmo, _type: string, id: string) {
7
const url = new URL(`https://api.mezmo.com/v1/config/categories/${_type}/${id}`)
8
9
const response = await fetch(url, {
10
method: 'DELETE',
11
headers: {
12
Authorization: 'Token ' + auth.apiKey
13
},
14
body: undefined
15
})
16
if (!response.ok) {
17
const text = await response.text()
18
throw new Error(`${response.status} ${text}`)
19
}
20
return await response.json()
21
22