Fix js search in undefined ocs response

Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
Signed-off-by: npmbuildbot-nextcloud[bot] <npmbuildbot-nextcloud[bot]@users.noreply.github.com>
This commit is contained in:
John Molakvoæ (skjnldsv) 2020-11-07 23:29:23 +01:00 committed by npmbuildbot-nextcloud[bot]
parent 0d52ba6239
commit 49676d909b
3 changed files with 5 additions and 5 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -53,7 +53,7 @@ export default {
async createShare({ path, permissions, shareType, shareWith, publicUpload, password, sendPasswordByTalk, expireDate, label }) {
try {
const request = await axios.post(shareUrl, { path, permissions, shareType, shareWith, publicUpload, password, sendPasswordByTalk, expireDate, label })
if (!('ocs' in request.data)) {
if (!request?.data?.ocs) {
throw request
}
return new Share(request.data.ocs.data)
@ -73,7 +73,7 @@ export default {
async deleteShare(id) {
try {
const request = await axios.delete(shareUrl + `/${id}`)
if (!('ocs' in request.data)) {
if (!request?.data?.ocs) {
throw request
}
return true
@ -93,7 +93,7 @@ export default {
async updateShare(id, properties) {
try {
const request = await axios.put(shareUrl + `/${id}`, properties, headers)
if (!('ocs' in request.data)) {
if (!request?.data?.ocs) {
throw request
}
return true