Skip to content

Commit

Permalink
Allow deleting views 2
Browse files Browse the repository at this point in the history
  • Loading branch information
adrinr committed Jul 19, 2023
1 parent 9ede613 commit 60f7d60
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
6 changes: 5 additions & 1 deletion packages/builder/src/stores/backend/views.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 => {
Expand Down
7 changes: 7 additions & 0 deletions packages/frontend-core/src/api/viewsV2.js
Original file line number Diff line number Diff line change
Expand Up @@ -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}` })
},
})

0 comments on commit 60f7d60

Please sign in to comment.