diff --git a/src/js/Api/polls.js b/src/js/Api/polls.js index fb32ca4f4..14bf34a4c 100644 --- a/src/js/Api/polls.js +++ b/src/js/Api/polls.js @@ -139,7 +139,7 @@ const polls = { setSubscription(pollId, subscription) { return httpInstance.request({ method: 'PUT', - url: `poll/${pollId}${subscription ? '/unsubscribe' : '/subscribe'}`, + url: `poll/${pollId}${subscription ? '/subscribe' : '/unsubscribe'}`, cancelToken: cancelTokenHandlerObject[this.setSubscription.name].handleRequestCancellation().token, }) }, diff --git a/src/js/store/modules/subscription.js b/src/js/store/modules/subscription.js index 363de6527..74f3e4022 100644 --- a/src/js/store/modules/subscription.js +++ b/src/js/store/modules/subscription.js @@ -68,9 +68,9 @@ const actions = { try { let response = null if (context.rootState.route.name === 'publicVote') { - response = await PublicAPI.setSubscription(context.rootState.route.params.token) + response = await PublicAPI.setSubscription(context.rootState.route.params.token, !context.state.subscribed) } else if (context.rootState.route.name === 'vote') { - response = await PollsAPI.setSubscription(context.rootState.route.params.id) + response = await PollsAPI.setSubscription(context.rootState.route.params.id, !context.state.subscribed) } else { context.commit('reset') return