Commit 504ef7a5 authored by Constance Okoghenun's avatar Constance Okoghenun

Made delete wiki modal component props required and changed the component init behaviour

parent 22651a63
...@@ -10,17 +10,17 @@ export default { ...@@ -10,17 +10,17 @@ export default {
props: { props: {
deleteWikiUrl: { deleteWikiUrl: {
type: String, type: String,
required: false, required: true,
default: '', default: '',
}, },
pageTitle: { pageTitle: {
type: String, type: String,
required: false, required: true,
default: '', default: '',
}, },
csrfToken: { csrfToken: {
type: String, type: String,
required: false, required: true,
default: '', default: '',
}, },
}, },
......
...@@ -14,8 +14,12 @@ document.addEventListener('DOMContentLoaded', () => { ...@@ -14,8 +14,12 @@ document.addEventListener('DOMContentLoaded', () => {
new ZenMode(); // eslint-disable-line no-new new ZenMode(); // eslint-disable-line no-new
new GLForm($('.wiki-form'), true); // eslint-disable-line no-new new GLForm($('.wiki-form'), true); // eslint-disable-line no-new
const deleteWikiButton = document.getElementById('delete-wiki-button');
if (deleteWikiButton) {
Vue.use(Translate); Vue.use(Translate);
const { deleteWikiUrl, pageTitle } = document.getElementById('delete-wiki-button').dataset;
const { deleteWikiUrl, pageTitle } = deleteWikiButton.dataset;
const deleteWikiModalEl = document.getElementById('delete-wiki-modal'); const deleteWikiModalEl = document.getElementById('delete-wiki-modal');
const deleteModal = new Vue({ // eslint-disable-line const deleteModal = new Vue({ // eslint-disable-line
el: deleteWikiModalEl, el: deleteWikiModalEl,
...@@ -32,4 +36,5 @@ document.addEventListener('DOMContentLoaded', () => { ...@@ -32,4 +36,5 @@ document.addEventListener('DOMContentLoaded', () => {
}); });
}, },
}); });
}
}); });
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment