Welcome to mirror list, hosted at ThFree Co, Russian Federation.

action.vue « components « src - github.com/nextcloud/notifications.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 1c89c12f3269f4d95388f8b0f28134a88caf464f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
<template>
	<button class="action-button pull-right" :class="{ primary: primary }"
		:data-type="type" :data-href="link" @click="onClickActionButton">{{label}}</button>
</template>

<script>
	import axios from 'axios';
	export default {
		name: 'action',

		props: [
			'label',
			'link',
			'type',
			'primary'
		],

		methods: {
			onClickActionButton: function () {
				axios({
					method: this.type || 'GET',
					url: this.link,
					headers: { requesttoken: OC.requestToken }
				})
				.then(response => {
					this.$parent._$el.fadeOut(OC.menuSpeed);
					this.$parent.$emit('remove');
					$('body').trigger(new $.Event('OCA.Notification.Action', {
						notification: this.$parent,
						action: {
							url: this.link,
							type: this.type || 'GET'
						}
					}));
				})
				.catch(err => {
					OC.Notification.showTemporary(t('notifications', 'Failed to perform action'));
				});
			}
		}
	}
</script>