vikunja-frontend/src/services/label.js
konrad cac8b09263 Add limits for kanban boards (#234)
Prevent dropping a task onto a bucket which has its limit reached

Fix closing the dropdown

Add notice to show the limit

Add input to change kanban bucket limit

Add menu item to save bucket limit

Fix parsing dates from the api

Co-authored-by: kolaente <k@knt.li>
Reviewed-on: https://kolaente.dev/vikunja/frontend/pulls/234
2020-09-04 20:01:02 +00:00

34 lines
No EOL
721 B
JavaScript

import AbstractService from './abstractService'
import LabelModel from '../models/label'
import {formatISO} from 'date-fns'
export default class LabelService extends AbstractService {
constructor() {
super({
create: '/labels',
getAll: '/labels',
get: '/labels/{id}',
update: '/labels/{id}',
delete: '/labels/{id}',
})
}
processModel(label) {
label.created = formatISO(new Date(label.created))
label.updated = formatISO(new Date(label.updated))
label.hexColor = label.hexColor.substring(1, 7)
return label
}
modelFactory(data) {
return new LabelModel(data)
}
beforeUpdate(label) {
return this.processModel(label)
}
beforeCreate(label) {
return this.processModel(label)
}
}