Skip to content

undefined type #95

Answered by MrRefactoring
Joseaestevez asked this question in Q&A
Jan 6, 2021 · 1 comments · 1 reply
Discussion options

You must be logged in to vote

You are trying to take an index value from Promise. You can't do that in JavaScript, you have to wait for Promise to execute first, and then work with the data. This library supports 3 variants of data retrieval:

Callback

import { Client } from 'jira.js';

const client = new Client({ host: '...' });

client.projects.getAllProjects({}, (error, data) => {
  console.log('error', error);
  console.log('data', data);
});

Promise

import { Client } from 'jira.js';

const client = new Client({ host: '...' });

client.projects.getAllProjects()
  .then((data) => console.log('data', data))
  .catch((error) => console.log('error', error));

Async/Await

import { Client } from 'jira.js';

const client = n…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@Joseaestevez
Comment options

Answer selected by MrRefactoring
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants