diff options
author | Christoph Wurst <ChristophWurst@users.noreply.github.com> | 2020-02-03 19:59:14 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-02-03 19:59:14 +0300 |
commit | 70962a95ac6bf61079976c13380d809ef754ef6a (patch) | |
tree | 57160d1081f56073ff6424303087962b5b35514a /src | |
parent | d070e25f5b33f2b96d92106b44858eee04ba85bb (diff) | |
parent | 7a329522b1f4bf21db6b08b7964cef557b74d411 (diff) |
Merge pull request #2604 from nextcloud/fix/sync-no-uids
Fix HTTP500 when no UIDs are sent
Diffstat (limited to 'src')
-rw-r--r-- | src/service/MessageService.js | 43 |
1 files changed, 25 insertions, 18 deletions
diff --git a/src/service/MessageService.js b/src/service/MessageService.js index cf1b5308f..0b2861a70 100644 --- a/src/service/MessageService.js +++ b/src/service/MessageService.js @@ -1,5 +1,5 @@ import {generateUrl} from '@nextcloud/router' -import HttpClient from '@nextcloud/axios' +import axios from '@nextcloud/axios' import {parseErrorResponse} from '../http/ErrorResponseParser' @@ -17,9 +17,11 @@ export function fetchEnvelopes(accountId, folderId, query, cursor) { params.cursor = cursor } - return HttpClient.get(url, { - params: params, - }).then(resp => resp.data) + return axios + .get(url, { + params: params, + }) + .then(resp => resp.data) } export function syncEnvelopes(accountId, folderId, uids) { @@ -28,11 +30,13 @@ export function syncEnvelopes(accountId, folderId, uids) { folderId, }) - return HttpClient.get(url, { - params: { - uids, - }, - }).then(resp => resp.data) + return axios + .get(url, { + params: { + uids, + }, + }) + .then(resp => resp.data) } export function setEnvelopeFlag(accountId, folderId, id, flag, value) { @@ -45,11 +49,13 @@ export function setEnvelopeFlag(accountId, folderId, id, flag, value) { const flags = {} flags[flag] = value - return HttpClient.put(url, { - flags: flags, - }).then(() => { - value - }) + return axios + .put(url, { + flags: flags, + }) + .then(() => { + value + }) } export function fetchMessage(accountId, folderId, id) { @@ -59,7 +65,8 @@ export function fetchMessage(accountId, folderId, id) { id, }) - return HttpClient.get(url) + return axios + .get(url) .then(resp => resp.data) .catch(error => { if (error.response && error.response.status === 404) { @@ -74,7 +81,7 @@ export function saveDraft(accountId, data) { accountId, }) - return HttpClient.post(url, data).then(resp => resp.data) + return axios.post(url, data).then(resp => resp.data) } export function sendMessage(accountId, data) { @@ -82,7 +89,7 @@ export function sendMessage(accountId, data) { accountId, }) - return HttpClient.post(url, data).then(resp => resp.data) + return axios.post(url, data).then(resp => resp.data) } export function deleteMessage(accountId, folderId, id) { @@ -92,5 +99,5 @@ export function deleteMessage(accountId, folderId, id) { id, }) - return HttpClient.delete(url).then(resp => resp.data) + return axios.delete(url).then(resp => resp.data) } |