Skip to content

Commit

Permalink
Merge pull request #2286 from nextcloud/fix/chain-condition
Browse files Browse the repository at this point in the history
Fix chain condition of responses
  • Loading branch information
skjnldsv authored Jun 18, 2021
2 parents a2e162d + 16efaad commit 33c4413
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/components/ContactDetails.vue
Original file line number Diff line number Diff line change
Expand Up @@ -573,7 +573,7 @@ export default {
} catch (error) {
if (error.name === 'ParserError') {
showError(t('contacts', 'Syntax error. Cannot open the contact.'))
} else if (error.status === 404) {
} else if (error?.status === 404) {
showError(t('contacts', 'The contact doesn\'t exists anymore on the server.'))
} else {
showError(t('contacts', 'Unable to retrieve the contact from the server, please check your network connection.'))
Expand Down
4 changes: 2 additions & 2 deletions src/components/ContactDetails/ContactDetailsAvatar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -427,7 +427,7 @@ export default {
id: this.contact.addressbook.id,
uid: this.contact.uid,
}))
if (response.status !== 200) {
if (response?.status !== 200) {
throw new URIError('Download of social profile avatar failed')
}

Expand All @@ -441,7 +441,7 @@ export default {
// Notify user
showSuccess(t('contacts', 'Avatar downloaded from social network'))
} catch (error) {
if (error.response.status === 304) {
if (error?.response?.status === 304) {
showInfo(t('contacts', 'Avatar already up to date'))
} else {
showError(t('contacts', 'Avatar download failed'))
Expand Down
2 changes: 1 addition & 1 deletion src/components/MembersList/MembersListItem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ export default {
leave: this.isCurrentUser,
})
} catch (error) {
if (error.response.status === 404) {
if (error?.response?.status === 404) {
this.logger.debug('Member is not in circle')
return
}
Expand Down
2 changes: 1 addition & 1 deletion src/store/contacts.js
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,7 @@ const actions = {
console.error(error)

// wrong etag, we most likely have a conflict
if (error && error.status === 412) {
if (error && error?.status === 412) {
// saving the new etag so that the user can manually
// trigger a fetchCompleteData without any further errors
context.commit('setContactAsConflict', { contact, etag: error.xhr.getResponseHeader('etag') })
Expand Down

0 comments on commit 33c4413

Please sign in to comment.