diff --git a/src/stores/federation.js b/src/stores/federation.js index 908d8cf61838..5d4bc5228788 100644 --- a/src/stores/federation.js +++ b/src/stores/federation.js @@ -23,6 +23,8 @@ import { defineStore } from 'pinia' import Vue from 'vue' +import { showError } from '@nextcloud/dialogs' + import { FEDERATION } from '../constants.js' import { getShares, acceptShare, rejectShare } from '../services/federationService.js' @@ -106,16 +108,6 @@ export const useFederationStore = defineStore('federation', { Vue.set(this.pendingShares, invitation.id, invitation) }, - /** - * Mark an invitation as loading in store. - * - * @param {number} id invitation id - * @param {boolean} value loading state - */ - markInvitationLoading(id, value) { - Vue.set(this.pendingShares[id], 'loading', value) - }, - /** * Mark an invitation as accepted in store. * @@ -126,7 +118,6 @@ export const useFederationStore = defineStore('federation', { if (!this.pendingShares[id]) { return } - Vue.delete(this.pendingShares[id], 'loading') Vue.set(this.acceptedShares, id, { ...this.pendingShares[id], accessToken: conversation.remoteAccessToken, @@ -146,15 +137,13 @@ export const useFederationStore = defineStore('federation', { if (!this.pendingShares[id]) { return } - this.markInvitationLoading(id, true) try { const response = await acceptShare(id) - this.markInvitationLoading(id, false) this.markInvitationAccepted(id, response.data.ocs.data) return response.data.ocs.data } catch (error) { console.error(error) - this.markInvitationLoading(id, false) + showError(t('spreed', 'An error occurred while accepting an invitation')) } }, @@ -167,13 +156,12 @@ export const useFederationStore = defineStore('federation', { if (!this.pendingShares[id]) { return } - this.markInvitationLoading(id, true) try { await rejectShare(id) Vue.delete(this.pendingShares, id) } catch (error) { console.error(error) - this.markInvitationLoading(id, false) + showError(t('spreed', 'An error occurred while rejecting an invitation')) } }, },