Add API to register card actions

Signed-off-by: Julius Härtl <jus@bitgrid.net>
This commit is contained in:
Julius Härtl
2021-02-02 19:05:40 +01:00
parent 4718a1bb2d
commit 52b21e271a
5 changed files with 103 additions and 2 deletions

42
src/store/actions.js Normal file
View File

@@ -0,0 +1,42 @@
/*
* @copyright Copyright (c) 2021 Julius Härtl <jus@bitgrid.net>
*
* @author Julius Härtl <jus@bitgrid.net>
*
* @license GNU AGPL version 3 or any later version
*
* 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/>.
*
*/
export default {
state: {
actions: {
card: [],
},
},
getters: {
cardActions: (state) => state.actions.card,
},
mutations: {
ADD_CARD_ACTION(state, action) {
state.actions.card.push(action)
},
},
actions: {
async addCardAction({ commit }, action) {
commit('ADD_CARD_ACTION', action)
},
},
}

View File

@@ -28,6 +28,7 @@ import Vuex from 'vuex'
import axios from '@nextcloud/axios'
import { generateOcsUrl } from '@nextcloud/router'
import { BoardApi } from '../services/BoardApi'
import actions from './actions'
import stack from './stack'
import card from './card'
import comment from './comment'
@@ -47,6 +48,7 @@ export const BOARD_FILTERS = {
export default new Vuex.Store({
modules: {
actions,
stack,
card,
comment,

View File

@@ -34,6 +34,9 @@ export default {
stacksByBoard: state => (id) => {
return state.stacks.filter((stack) => stack.boardId === id).sort((a, b) => a.order - b.order)
},
stackById: state => (id) => {
return state.stacks.find((stack) => stack.id === id)
},
},
mutations: {
addStack(state, stack) {