Adjust generateOcsUrl calls

Signed-off-by: Julius Härtl <jus@bitgrid.net>
This commit is contained in:
Julius Härtl
2021-04-14 16:18:10 +02:00
parent 5ea056ee05
commit 6fb99df3e4
8 changed files with 12 additions and 12 deletions

View File

@@ -84,7 +84,7 @@ export default {
params.append('object_id', '' + this.objectId)
params.append('limit', ACTIVITY_FETCH_LIMIT)
const response = await axios.get(generateOcsUrl('apps/activity/api/v2/activity') + this.filter + '?' + params)
const response = await axios.get(generateOcsUrl(`apps/activity/api/v2/activity/${this.filter}`) + '?' + params)
let activities = response.data.ocs.data
if (this.filter === 'deck') {
// We need to manually filter activities here, since currently we use two different types and there is no way

View File

@@ -210,7 +210,7 @@ export default {
throw new Error(t('files', 'Invalid path selected'))
}
axios.post(generateOcsUrl('apps/files_sharing/api/v1', 2) + 'shares', {
axios.post(generateOcsUrl('apps/files_sharing/api/v1/shares'), {
path,
shareType: 12,
shareWith: '' + this.cardId,

View File

@@ -163,7 +163,7 @@ export default {
if (this.isAdmin) {
this.groupLimit = this.$store.getters.config('groupLimit')
this.groupLimitDisabled = false
axios.get(generateOcsUrl('cloud', 2) + 'groups').then((response) => {
axios.get(generateOcsUrl('cloud/groups')).then((response) => {
this.groups = response.data.ocs.data.groups.reduce((obj, item) => {
obj.push({
id: item,

View File

@@ -63,7 +63,7 @@ const createCancelToken = () => axios.CancelToken.source()
function search({ query, cursor }) {
const cancelToken = createCancelToken()
const request = async() => axios.get(generateOcsUrl('apps/deck/api/v1.0', 2) + '/search', {
const request = async() => axios.get(generateOcsUrl('apps/deck/api/v1.0/search'), {
cancelToken: cancelToken.token,
params: {
term: query,

View File

@@ -31,7 +31,7 @@ export class CommentApi {
}
async loadComments({ cardId, limit, offset }) {
const api = await axios.get(generateOcsUrl('apps/deck/api/v1.0/cards', 2) + `${cardId}/comments`, {
const api = await axios.get(generateOcsUrl(`apps/deck/api/v1.0/cards${cardId}/comments`), {
params: { limit, offset },
headers: { 'OCS-APIRequest': 'true' },
})
@@ -39,7 +39,7 @@ export class CommentApi {
}
async createComment({ cardId, comment, replyTo }) {
const api = await axios.post(generateOcsUrl('apps/deck/api/v1.0/cards', 2) + `${cardId}/comments`, {
const api = await axios.post(generateOcsUrl(`apps/deck/api/v1.0/cards/${cardId}/comments`), {
message: `${comment}`,
parentId: replyTo ? replyTo.id : null,
})
@@ -47,14 +47,14 @@ export class CommentApi {
}
async updateComment({ cardId, id, comment }) {
const api = await axios.put(generateOcsUrl('apps/deck/api/v1.0/cards', 2) + `${cardId}/comments/${id}`, {
const api = await axios.put(generateOcsUrl(`apps/deck/api/v1.0/cards/${cardId}/comments/${id}`), {
message: `${comment}`,
})
return api.data.ocs.data
}
async deleteComment({ cardId, id }) {
const api = await axios.delete(generateOcsUrl('apps/deck/api/v1.0/cards', 2) + `${cardId}/comments/${id}`)
const api = await axios.delete(generateOcsUrl(`apps/deck/api/v1.0/cards/${cardId}/comments/${id}`))
return api.data.ocs.data
}

View File

@@ -26,7 +26,7 @@ import { generateOcsUrl } from '@nextcloud/router'
export class OverviewApi {
url(url) {
return generateOcsUrl('apps/deck/api/v1.0') + url
return generateOcsUrl(`apps/deck/api/v1.0/${url}`)
}
get(filter) {

View File

@@ -22,7 +22,7 @@
import axios from '@nextcloud/axios'
import { generateOcsUrl } from '@nextcloud/router'
const shareUrl = generateOcsUrl('apps/files_sharing/api/v1', 2) + 'shares'
const shareUrl = generateOcsUrl('apps/files_sharing/api/v1/shares')
const createShare = async function({ path, permissions, shareType, shareWith, publicUpload, password, sendPasswordByTalk, expireDate, label }) {
try {

View File

@@ -317,7 +317,7 @@ export default new Vuex.Store({
async setConfig({ commit }, config) {
for (const key in config) {
try {
await axios.post(generateOcsUrl('apps/deck/api/v1.0/config') + key, {
await axios.post(generateOcsUrl(`apps/deck/api/v1.0/config/${key}`), {
value: config[key],
})
commit('SET_CONFIG', { key, value: config[key] })
@@ -421,7 +421,7 @@ export default new Vuex.Store({
params.append('perPage', 20)
params.append('itemType', [0, 1, 4, 7])
const response = await axios.get(generateOcsUrl('apps/files_sharing/api/v1') + 'sharees', { params })
const response = await axios.get(generateOcsUrl('apps/files_sharing/api/v1/sharees'), { params })
commit('setSharees', response.data.ocs.data)
},