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