debian-mirror-gitlab/app/assets/javascripts/sidebar/components/subscriptions/sidebar_subscriptions.vue

48 lines
1,006 B
Vue
Raw Normal View History

2018-03-17 18:26:18 +05:30
<script>
import Store from '../../stores/sidebar_store';
import eventHub from '../../event_hub';
import Flash from '../../../flash';
import { __ } from '../../../locale';
import subscriptions from './subscriptions.vue';
export default {
components: {
subscriptions,
},
props: {
mediator: {
type: Object,
required: true,
},
},
data() {
return {
store: new Store(),
};
},
created() {
eventHub.$on('toggleSubscription', this.onToggleSubscription);
},
beforeDestroy() {
eventHub.$off('toggleSubscription', this.onToggleSubscription);
},
methods: {
onToggleSubscription() {
this.mediator.toggleSubscription()
.catch(() => {
Flash(__('Error occurred when toggling the notification subscription'));
});
},
},
};
</script>
<template>
<div class="block subscriptions">
<subscriptions
:loading="store.isFetching.subscriptions"
:subscribed="store.subscribed"
/>
</div>
</template>