diff options
author | Marco <marcoambrosini@icloud.com> | 2022-12-19 19:23:50 +0100 |
---|---|---|
committer | Marco <marcoambrosini@icloud.com> | 2023-01-24 15:10:55 +0000 |
commit | a6c780a800c0622916d49ea6d283cb5e4fe92d24 (patch) | |
tree | b6a341f418c7c1a380dc0697650838c13cbcf7c3 | |
parent | accf3aaf2facd4ff95e6390e8c97d2c61ab3dfc9 (diff) |
Add breakoutrooms references to the store
-rw-r--r-- | src/store/breakoutRoomsStore.js | 48 |
1 files changed, 25 insertions, 23 deletions
diff --git a/src/store/breakoutRoomsStore.js b/src/store/breakoutRoomsStore.js index 2fd622003..f6ce7f405 100644 --- a/src/store/breakoutRoomsStore.js +++ b/src/store/breakoutRoomsStore.js @@ -19,34 +19,32 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. * */ - -/** - * @copyright Copyright (c) 2022 Marco Ambrosini <marcoambrosini@pm.me> - * - * @author Marco Ambrosini <marcoambrosini@pm.me> - * - * @license AGPL-3.0-or-later - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - * - */ import { configureBreakoutRooms, deleteBreakoutRooms, getBreakoutRooms, } from '../services/breakoutRoomsService.js' import { showError } from '@nextcloud/dialogs' +import { set } from 'vue' + +const state = { + breakoutRoomsReferences: {}, +} + +const getters = { + breakoutRoomsReferences: (state) => (token) => { + return state[token] + }, +} + +const mutations = { + addBreakoutRoomsReferences(state, { token, breakoutRoomsReferences }) { + if (!state[token]) { + state[token] = [] + } + set(state, token, breakoutRoomsReferences) + }, +} const actions = { async configureBreakoutRoomsAction(context, { token, mode, amount, attendeeMap }) { @@ -70,6 +68,10 @@ const actions = { async getBreakoutRoomsAction(context, { token }) { try { const response = await getBreakoutRooms(token) + context.commit('addBreakoutRoomsReferences', { + token, + breakoutRoomsReferences: response.data.ocs.data.map(conversation => conversation.token), + }) console.debug('response', response) } catch (error) { console.error(error) @@ -77,4 +79,4 @@ const actions = { }, } -export default { actions } +export default { state, getters, mutations, actions } |