debian-mirror-gitlab/app/assets/javascripts/admin/topics/index.js

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

54 lines
1.1 KiB
JavaScript
Raw Normal View History

2022-05-07 20:08:51 +05:30
import Vue from 'vue';
2022-10-11 01:57:18 +05:30
import VueApollo from 'vue-apollo';
import createDefaultClient from '~/lib/graphql';
import showToast from '~/vue_shared/plugins/global_toast';
2022-05-07 20:08:51 +05:30
import RemoveAvatar from './components/remove_avatar.vue';
2022-10-11 01:57:18 +05:30
import MergeTopics from './components/merge_topics.vue';
2022-05-07 20:08:51 +05:30
2022-10-11 01:57:18 +05:30
const toasts = document.querySelectorAll('.js-toast-message');
toasts.forEach((toast) => showToast(toast.dataset.message));
Vue.use(VueApollo);
const apolloProvider = new VueApollo({
defaultClient: createDefaultClient(),
});
export const initRemoveAvatar = () => {
2022-05-07 20:08:51 +05:30
const el = document.querySelector('.js-remove-topic-avatar');
if (!el) {
return false;
}
2022-06-21 17:19:12 +05:30
const { path, name } = el.dataset;
2022-05-07 20:08:51 +05:30
return new Vue({
el,
provide: {
path,
2022-06-21 17:19:12 +05:30
name,
2022-05-07 20:08:51 +05:30
},
render(h) {
return h(RemoveAvatar);
},
});
};
2022-10-11 01:57:18 +05:30
export const initMergeTopics = () => {
const el = document.querySelector('.js-merge-topics');
if (!el) return false;
const { path } = el.dataset;
return new Vue({
el,
apolloProvider,
provide: { path },
render(createElement) {
return createElement(MergeTopics);
},
});
};