Merge branch '262-preset-remarks-and-labels-no-longer-working-with-api-0-4-0' into 'devel'

Resolve "Preset remarks and labels no longer working with API 0.4.0"

Closes #262

See merge request wgp/dougal/software!36
This commit is contained in:
D. Berge
2023-09-10 10:10:22 +00:00
2 changed files with 9 additions and 8 deletions

View File

@@ -604,16 +604,16 @@ export default {
async getLabelDefinitions () {
const url = `/project/${this.$route.params.project}/label`;
const labelSet = {};
const labels = await this.api([url]) || [];
labels.forEach( l => labelSet[l.name] = l.data );
this.labels = labelSet;
//const labelSet = {};
this.labels = await this.api([url]) ?? {};
//labels.forEach( l => labelSet[l.name] = l.data );
//this.labels = labelSet;
},
async getPresetRemarks () {
const url = `/project/${this.$route.params.project}/configuration/events/presetRemarks`;
const url = `/project/${this.$route.params.project}/configuration`;
this.presetRemarks = await this.api([url]);
this.presetRemarks = (await this.api([url]))?.events?.presetRemarks ?? {};
},
newItem (from = {}) {

View File

@@ -1,10 +1,11 @@
const { label } = require('../../../lib/db');
const { project } = require('../../../lib/db');
module.exports = async function (req, res, next) {
try {
res.status(200).send(await label.list(req.params.project, req.query));
const labels = (await project.configuration.get(req.params.project))?.labels ?? {};
res.status(200).send(labels);
next();
} catch (err) {
next(err);