debian-mirror-gitlab/app/assets/javascripts/profile/account/index.js

49 lines
1.5 KiB
JavaScript
Raw Normal View History

2018-03-17 18:26:18 +05:30
import Vue from 'vue';
2021-03-11 19:13:27 +05:30
import { BV_SHOW_MODAL } from '~/lib/utils/constants';
2018-03-17 18:26:18 +05:30
import Translate from '~/vue_shared/translate';
import deleteAccountModal from './components/delete_account_modal.vue';
2021-03-11 19:13:27 +05:30
import UpdateUsername from './components/update_username.vue';
2018-03-17 18:26:18 +05:30
2018-03-27 19:54:05 +05:30
export default () => {
Vue.use(Translate);
2018-03-17 18:26:18 +05:30
2018-05-09 12:01:36 +05:30
const updateUsernameElement = document.getElementById('update-username');
// eslint-disable-next-line no-new
new Vue({
el: updateUsernameElement,
components: {
UpdateUsername,
},
render(createElement) {
return createElement('update-username', {
props: { ...updateUsernameElement.dataset },
});
},
});
2018-03-27 19:54:05 +05:30
const deleteAccountButton = document.getElementById('delete-account-button');
const deleteAccountModalEl = document.getElementById('delete-account-modal');
// eslint-disable-next-line no-new
new Vue({
el: deleteAccountModalEl,
components: {
deleteAccountModal,
},
mounted() {
2022-08-13 15:12:31 +05:30
deleteAccountButton.disabled = false;
2020-11-24 15:15:51 +05:30
deleteAccountButton.addEventListener('click', () => {
2021-03-11 19:13:27 +05:30
this.$root.$emit(BV_SHOW_MODAL, 'delete-account-modal', '#delete-account-button');
2020-11-24 15:15:51 +05:30
});
2018-03-27 19:54:05 +05:30
},
render(createElement) {
return createElement('delete-account-modal', {
props: {
actionUrl: deleteAccountModalEl.dataset.actionUrl,
2019-09-04 21:01:54 +05:30
confirmWithPassword: Boolean(deleteAccountModalEl.dataset.confirmWithPassword),
2018-03-27 19:54:05 +05:30
username: deleteAccountModalEl.dataset.username,
},
});
},
});
};