diff --git a/src/pages/Editor.vue b/src/pages/Editor.vue index ffbd8a2..324262a 100644 --- a/src/pages/Editor.vue +++ b/src/pages/Editor.vue @@ -368,6 +368,35 @@ const saveEditorPage = async (close = false) => { } } +const deleteEditorPage = async (close = false) => { + const params = { + serialData: JSON.stringify(serialize()), + } as any + + if ( editorPageId.value ) { + params.pageId = editorPageId.value + } + + const response = await fetch('/api/editor/page', { + method: 'DELETE', + headers: { + 'Accept': 'application/json', + 'Content-Type': 'application/json' + }, + body: JSON.stringify(params), + }) + + const result = (await response.json()) as unknown as any + if (!result.success) { + return alert('Failed to delete page: ' + result.message) + } + + editorPageId.value = result.data.pageId + if ( close ) { + await router.push('/Listings') + } +} + const loadEditorPage = async () => { if ( !editorPageId.value ) { return @@ -567,6 +596,9 @@ onMounted(() => { + + +