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,22 +14,27 @@ document.addEventListener('DOMContentLoaded', () => { ...@@ -14,22 +14,27 @@ 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
Vue.use(Translate); const deleteWikiButton = document.getElementById('delete-wiki-button');
const { deleteWikiUrl, pageTitle } = document.getElementById('delete-wiki-button').dataset;
const deleteWikiModalEl = document.getElementById('delete-wiki-modal'); if (deleteWikiButton) {
const deleteModal = new Vue({ // eslint-disable-line Vue.use(Translate);
el: deleteWikiModalEl,
data: { const { deleteWikiUrl, pageTitle } = deleteWikiButton.dataset;
deleteWikiUrl: '', const deleteWikiModalEl = document.getElementById('delete-wiki-modal');
}, const deleteModal = new Vue({ // eslint-disable-line
render(createElement) { el: deleteWikiModalEl,
return createElement(deleteWikiModal, { data: {
props: { deleteWikiUrl: '',
pageTitle, },
deleteWikiUrl, render(createElement) {
csrfToken: csrf.token, return createElement(deleteWikiModal, {
}, props: {
}); pageTitle,
}, deleteWikiUrl,
}); csrfToken: csrf.token,
},
});
},
});
}
}); });
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