diff options
author | dartcafe <github@dartcafe.de> | 2020-05-02 10:25:15 +0300 |
---|---|---|
committer | dartcafe <github@dartcafe.de> | 2020-05-02 10:25:15 +0300 |
commit | 4455f8780be84e4a20b5edde495a5783e5bfc9b6 (patch) | |
tree | 645bbe19cd60c100105e92adee2a31e2344b4cab /src/js/store | |
parent | a0b8cba535418f3388680af82917b600f487bfb6 (diff) |
replace OC.generateUrl with @nextcloud/router
Diffstat (limited to 'src/js/store')
-rw-r--r-- | src/js/store/modules/acl.js | 3 | ||||
-rw-r--r-- | src/js/store/modules/comments.js | 7 | ||||
-rw-r--r-- | src/js/store/modules/options.js | 9 | ||||
-rw-r--r-- | src/js/store/modules/poll.js | 5 | ||||
-rw-r--r-- | src/js/store/modules/polls.js | 9 | ||||
-rw-r--r-- | src/js/store/modules/shares.js | 11 | ||||
-rw-r--r-- | src/js/store/modules/subscription.js | 5 | ||||
-rw-r--r-- | src/js/store/modules/votes.js | 7 |
8 files changed, 32 insertions, 24 deletions
diff --git a/src/js/store/modules/acl.js b/src/js/store/modules/acl.js index 33da7534..43f0c012 100644 --- a/src/js/store/modules/acl.js +++ b/src/js/store/modules/acl.js @@ -23,6 +23,7 @@ import axios from '@nextcloud/axios' import { getCurrentUser } from '@nextcloud/auth' +import { generateUrl } from '@nextcloud/router' const defaultAcl = () => { return { @@ -71,7 +72,7 @@ const actions = { return } - return axios.get(OC.generateUrl(endPoint)) + return axios.get(generateUrl(endPoint)) .then((response) => { context.commit('setAcl', { acl: response.data }) }, (error) => { diff --git a/src/js/store/modules/comments.js b/src/js/store/modules/comments.js index 606c9f10..fd20f675 100644 --- a/src/js/store/modules/comments.js +++ b/src/js/store/modules/comments.js @@ -22,6 +22,7 @@ */ import axios from '@nextcloud/axios' +import { generateUrl } from '@nextcloud/router' const defaultComments = () => { return { @@ -72,7 +73,7 @@ const actions = { return } - return axios.get(OC.generateUrl(endPoint)) + return axios.get(generateUrl(endPoint)) .then((response) => { context.commit('setComments', { list: response.data }) }, (error) => { @@ -88,7 +89,7 @@ const actions = { endPoint = endPoint.concat('s/') } - return axios.post(OC.generateUrl(endPoint), { + return axios.post(generateUrl(endPoint), { token: context.rootState.acl.token, comment: payload.comment, }) @@ -109,7 +110,7 @@ const actions = { endPoint = endPoint.concat('s/') } - return axios.post(OC.generateUrl(endPoint), { + return axios.post(generateUrl(endPoint), { pollId: context.rootState.poll.id, token: context.rootState.acl.token, message: payload.message, diff --git a/src/js/store/modules/options.js b/src/js/store/modules/options.js index 6f661ebe..42bf95c6 100644 --- a/src/js/store/modules/options.js +++ b/src/js/store/modules/options.js @@ -22,6 +22,7 @@ import axios from '@nextcloud/axios' import sortBy from 'lodash/sortBy' +import { generateUrl } from '@nextcloud/router' const defaultOptions = () => { return { @@ -91,7 +92,7 @@ const actions = { return } - return axios.get(OC.generateUrl(endPoint)) + return axios.get(generateUrl(endPoint)) .then((response) => { context.commit('optionsSet', { list: response.data }) }, (error) => { @@ -110,7 +111,7 @@ const actions = { updateOptionAsync(context, payload) { const endPoint = 'apps/polls/option/update' - return axios.post(OC.generateUrl(endPoint), { option: payload.option }) + return axios.post(generateUrl(endPoint), { option: payload.option }) .then(() => { context.commit('setOption', { option: payload.option }) }, (error) => { @@ -141,7 +142,7 @@ const actions = { option.pollOptionText = payload.pollOptionText } - return axios.post(OC.generateUrl(endPoint), { option: option }) + return axios.post(generateUrl(endPoint), { option: option }) .then((response) => { context.commit('setOption', { option: response.data }) }, (error) => { @@ -153,7 +154,7 @@ const actions = { removeOptionAsync(context, payload) { const endPoint = 'apps/polls/option/remove/' - return axios.post(OC.generateUrl(endPoint), { option: payload.option }) + return axios.post(generateUrl(endPoint), { option: payload.option }) .then(() => { context.commit('optionRemove', { option: payload.option }) }, (error) => { diff --git a/src/js/store/modules/poll.js b/src/js/store/modules/poll.js index a7087a71..6eb929df 100644 --- a/src/js/store/modules/poll.js +++ b/src/js/store/modules/poll.js @@ -22,6 +22,7 @@ */ import axios from '@nextcloud/axios' +import { generateUrl } from '@nextcloud/router' const defaultPoll = () => { return { @@ -95,7 +96,7 @@ const actions = { context.commit('resetPoll') return } - return axios.get(OC.generateUrl(endPoint)) + return axios.get(generateUrl(endPoint)) .then((response) => { context.commit('setPoll', { poll: response.data.poll }) context.commit('acl/setAcl', { acl: response.data.acl }) @@ -111,7 +112,7 @@ const actions = { writePollPromise(context) { const endPoint = 'apps/polls/polls/write/' - return axios.post(OC.generateUrl(endPoint), { poll: state }) + return axios.post(generateUrl(endPoint), { poll: state }) .then((response) => { context.commit('setPoll', { poll: response.data.poll }) context.commit('acl/setAcl', { acl: response.data.acl }) diff --git a/src/js/store/modules/polls.js b/src/js/store/modules/polls.js index a01ef2c7..96ced689 100644 --- a/src/js/store/modules/polls.js +++ b/src/js/store/modules/polls.js @@ -23,6 +23,7 @@ import axios from '@nextcloud/axios' import { getCurrentUser } from '@nextcloud/auth' +import { generateUrl } from '@nextcloud/router' const state = { list: [], @@ -73,7 +74,7 @@ const actions = { loadPolls(context) { const endPoint = 'apps/polls/polls/list/' - return axios.get(OC.generateUrl(endPoint)) + return axios.get(generateUrl(endPoint)) .then((response) => { context.commit('setPolls', { list: response.data }) }, (error) => { @@ -84,7 +85,7 @@ const actions = { switchDeleted(context, payload) { const endPoint = 'apps/polls/polls/delete/' - return axios.get(OC.generateUrl(endPoint + payload.pollId)) + return axios.get(generateUrl(endPoint + payload.pollId)) .then((response) => { return response }, (error) => { @@ -95,7 +96,7 @@ const actions = { deletePermanently(context, payload) { const endPoint = 'apps/polls/polls/delete/permanent/' - return axios.get(OC.generateUrl(endPoint + payload.pollId)) + return axios.get(generateUrl(endPoint + payload.pollId)) .then((response) => { OC.Notification.showTemporary(t('polls', 'Deleted poll permanently.'), { type: 'success' }) return response @@ -107,7 +108,7 @@ const actions = { clonePoll(context, payload) { const endPoint = 'apps/polls/polls/clone/' - return axios.get(OC.generateUrl(endPoint + payload.pollId)) + return axios.get(generateUrl(endPoint + payload.pollId)) .then((response) => { return response.data }, (error) => { diff --git a/src/js/store/modules/shares.js b/src/js/store/modules/shares.js index 0e9c1202..c704c3ff 100644 --- a/src/js/store/modules/shares.js +++ b/src/js/store/modules/shares.js @@ -22,6 +22,7 @@ */ import axios from '@nextcloud/axios' +import { generateUrl } from '@nextcloud/router' const defaultShares = () => { return { @@ -88,7 +89,7 @@ const actions = { return } - return axios.get(OC.generateUrl(endPoint)) + return axios.get(generateUrl(endPoint)) .then((response) => { context.commit('setShares', { list: response.data }) }, (error) => { @@ -101,7 +102,7 @@ const actions = { const endPoint = 'apps/polls/share/get/' - return axios.get(OC.generateUrl(endPoint + payload.token)) + return axios.get(generateUrl(endPoint + payload.token)) .then((response) => { return { share: response.data } }, (error) => { @@ -113,7 +114,7 @@ const actions = { createPersonalShare(context, payload) { const endPoint = 'apps/polls/share/create/s/' - return axios.post(OC.generateUrl(endPoint), { token: payload.token, userName: payload.userName }) + return axios.post(generateUrl(endPoint), { token: payload.token, userName: payload.userName }) .then((response) => { return { token: response.data.token } }, (error) => { @@ -126,7 +127,7 @@ const actions = { writeSharePromise(context, payload) { const endPoint = 'apps/polls/share/write/' payload.share.pollId = context.rootState.poll.id - return axios.post(OC.generateUrl(endPoint), { pollId: context.rootState.poll.id, share: payload.share }) + return axios.post(generateUrl(endPoint), { pollId: context.rootState.poll.id, share: payload.share }) .then((response) => { context.commit('addShare', response.data.share) @@ -165,7 +166,7 @@ const actions = { removeShareAsync(context, payload) { const endPoint = 'apps/polls/share/remove/' - return axios.post(OC.generateUrl(endPoint), { share: payload.share }) + return axios.post(generateUrl(endPoint), { share: payload.share }) .then(() => { context.commit('removeShare', { share: payload.share }) }, (error) => { diff --git a/src/js/store/modules/subscription.js b/src/js/store/modules/subscription.js index 8ff5e114..3b7da8a0 100644 --- a/src/js/store/modules/subscription.js +++ b/src/js/store/modules/subscription.js @@ -22,6 +22,7 @@ */ import axios from '@nextcloud/axios' +import { generateUrl } from '@nextcloud/router' const defaultSubscription = () => { return { @@ -41,7 +42,7 @@ const mutations = { const actions = { getSubscription(context, payload) { - axios.get(OC.generateUrl('apps/polls/subscription/get/' + payload.pollId)) + axios.get(generateUrl('apps/polls/subscription/get/' + payload.pollId)) .then(() => { context.commit('setSubscription', true) }) @@ -51,7 +52,7 @@ const actions = { }, writeSubscriptionPromise(context, payload) { - return axios.post(OC.generateUrl('apps/polls/subscription/set/'), { pollId: payload.pollId, subscribed: state.subscribed }) + return axios.post(generateUrl('apps/polls/subscription/set/'), { pollId: payload.pollId, subscribed: state.subscribed }) .then(() => { }, (error) => { console.error(error.response) diff --git a/src/js/store/modules/votes.js b/src/js/store/modules/votes.js index 131d48ba..34396816 100644 --- a/src/js/store/modules/votes.js +++ b/src/js/store/modules/votes.js @@ -22,6 +22,7 @@ import axios from '@nextcloud/axios' import orderBy from 'lodash/orderBy' +import { generateUrl } from '@nextcloud/router' const defaultVotes = () => { return { @@ -166,7 +167,7 @@ const actions = { return } - axios.get(OC.generateUrl(endPoint)) + axios.get(generateUrl(endPoint)) .then((response) => { context.commit('setVotes', { list: response.data }) }, (error) => { @@ -177,7 +178,7 @@ const actions = { deleteVotes(context, payload) { const endPoint = 'apps/polls/votes/delete/' - return axios.post(OC.generateUrl(endPoint), { + return axios.post(generateUrl(endPoint), { pollId: context.rootState.poll.id, voteId: 0, userId: payload.userId, @@ -198,7 +199,7 @@ const actions = { endPoint = endPoint.concat('s/') } - return axios.post(OC.generateUrl(endPoint), { + return axios.post(generateUrl(endPoint), { pollId: context.rootState.poll.id, token: context.rootState.acl.token, option: payload.option, |