Allow deleting views 2

This commit is contained in:
Adria Navarro 2023-07-19 12:20:19 +02:00
parent 16764e6634
commit 1e9ce06504
2 changed files with 12 additions and 1 deletions

View File

@ -26,7 +26,11 @@ export function createViewsStore() {
}
const deleteView = async view => {
await API.deleteView(view.name)
if (view.version === 2) {
await API.viewV2.delete(view._id)
} else {
await API.deleteView(view.name)
}
// Update tables
tables.update(state => {

View File

@ -13,4 +13,11 @@ export const buildViewV2Endpoints = API => ({
fetch: async id => {
return await API.get({ url: `/api/v2/views/${id}/search` })
},
/**
* Delete a view
* @param id the id of the view to delete
*/
delete: async id => {
return await API.delete({ url: `/api/v2/views/${id}` })
},
})