Skip to content

Commit

Permalink
Fetch share again via OCS request if it's not in the response
Browse files Browse the repository at this point in the history
  • Loading branch information
kulmann committed Apr 20, 2021
1 parent b0c2b96 commit 09a0935
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions packages/web-app-files/src/views/SharedWithMe.vue
Original file line number Diff line number Diff line change
Expand Up @@ -226,15 +226,28 @@ export default {
async triggerShareAction(resource, type) {
try {
// exec share action
let response = await this.$client.requests.ocs({
service: 'apps/files_sharing',
action: `api/v1/shares/pending/${resource.share.id}`,
method: type
})
response = await response.json()
if (response.ocs.data.length > 0) {
// get updated share from response or re-fetch it
let share = null
if (response.headers.map['content-length'] > 0) {
response = await response.json()
if (response.ocs.data.length > 0) {
share = response.ocs.data[0]
}
} else {
share = await this.$client.shares.getShare(resource.share.id)
}
// update share in store
if (share) {
const sharedResource = await buildSharedResource(
response.ocs.data[0],
share,
true,
!this.isOcis,
this.configuration.server,
Expand Down

0 comments on commit 09a0935

Please sign in to comment.