From 003054b14b63c9886ba3e2531ce04a302d0c6c92 Mon Sep 17 00:00:00 2001 From: Maksim Sukharev Date: Tue, 20 Feb 2024 17:16:09 +0100 Subject: [PATCH] fixup! feat(federation): manage invitations through the store Signed-off-by: Maksim Sukharev --- src/stores/federation.js | 20 ++++---------------- 1 file changed, 4 insertions(+), 16 deletions(-) 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')) } }, },