index page cannot be deleted
This commit is contained in:
parent
54c7690e26
commit
eeeb4f9af6
1 changed files with 8 additions and 0 deletions
|
@ -22,10 +22,14 @@ export default class PostEditor {
|
|||
this.post = [];
|
||||
this.postID = null;
|
||||
this.postUUID = null;
|
||||
this.postLayout = null;
|
||||
api.authStatus();
|
||||
if (document.getElementById('post-edit-index').getAttribute('data-index')) {
|
||||
this.postID = document.getElementById('post-edit-index').getAttribute('data-index');
|
||||
this.postUUID = document.getElementById('post-edit-index').getAttribute('data-uuid');
|
||||
this.postLayout = document
|
||||
.getElementById('post-edit-index')
|
||||
.getAttribute('data-layout');
|
||||
}
|
||||
if (document.getElementById('edit-post-text')) {
|
||||
this.editor = new TextEditor(
|
||||
|
@ -163,6 +167,10 @@ export default class PostEditor {
|
|||
});
|
||||
break;
|
||||
case EditorEvent.EDITOR_DELETE:
|
||||
if (this.postLayout === 'index') {
|
||||
notify.alert('Index cannot be deleted', false);
|
||||
return;
|
||||
}
|
||||
if (confirm("AYE! You know you're deleting this post, right?")) {
|
||||
let id = { id: this.postUUID };
|
||||
api.request(
|
||||
|
|
Loading…
Reference in a new issue