🔀 Merge branch 'kitemaker-add-spaceid-to-create-workitem' of https://github.com/l4u/n8n into l4u-kitemaker-add-spaceid-to-create-workitem

This commit is contained in:
Jan Oberhauser
2021-12-23 13:32:03 +01:00
3 changed files with 30 additions and 1 deletions

View File

@@ -118,10 +118,16 @@ export class Kitemaker implements INodeType {
},
async getStatuses(this: ILoadOptionsFunctions) {
const spaceId = this.getNodeParameter('spaceId', 0) as string;
if (!spaceId.length) {
throw new Error('Please choose a space to set for the work item to create.');
}
const responseData = await kitemakerRequest.call(this, { query: getStatuses });
const { data: { organization: { spaces } } } = responseData;
const space = spaces.find((e: { [x: string]: string; }) => e.id == spaceId)
return createLoadOptions(spaces[0].statuses);
return createLoadOptions(space.statuses);
},
async getUsers(this: ILoadOptionsFunctions) {