Uncaught (in promise) TypeError: n.join is not a function
Uncaught (in promise) TypeError: n.join is not a function
我在 devops azure 上有一个扩展,顺便说一句,我是 Javascript 的新手。
我写了一个函数来从服务器获取它的 id 后获取任务的名称:
dataService.getDocument("registryKey").then((doc) => {
let authenToken = doc.value[doc.count - 1];
fetch('https://52.221.253.35/api/timelog'+query, {
method: 'GET',
headers:{
'Authentication': authenToken
}
}).then((resp) => resp.json()).then(function (data) {
let index = 1;
let body = "";
// foreach the data and i call VSS Http to get work item 's detail
data.forEach(async function f(item) {
let result = await witClient.getWorkItems(item.TaskId, ["System.Id", "System.Title"]);
body+="<p>"+result['System.Title']+"</p>"
$("#table-body").html(body);
});
但是运行的时候报错:Uncaught (in promise) TypeError: n.join is not a function
这里有什么问题?感谢您的评论。
试试这个:
let result = await witClient.getWorkItems([item.TaskId], ["System.Id", "System.Title"]);
body+="<p>"+result['System.Title']+"</p>"
$("#table-body").html(body);
});
注意第一个参数两边的方括号。
我在 devops azure 上有一个扩展,顺便说一句,我是 Javascript 的新手。 我写了一个函数来从服务器获取它的 id 后获取任务的名称:
dataService.getDocument("registryKey").then((doc) => {
let authenToken = doc.value[doc.count - 1];
fetch('https://52.221.253.35/api/timelog'+query, {
method: 'GET',
headers:{
'Authentication': authenToken
}
}).then((resp) => resp.json()).then(function (data) {
let index = 1;
let body = "";
// foreach the data and i call VSS Http to get work item 's detail
data.forEach(async function f(item) {
let result = await witClient.getWorkItems(item.TaskId, ["System.Id", "System.Title"]);
body+="<p>"+result['System.Title']+"</p>"
$("#table-body").html(body);
});
但是运行的时候报错:Uncaught (in promise) TypeError: n.join is not a function
这里有什么问题?感谢您的评论。
试试这个:
let result = await witClient.getWorkItems([item.TaskId], ["System.Id", "System.Title"]);
body+="<p>"+result['System.Title']+"</p>"
$("#table-body").html(body);
});
注意第一个参数两边的方括号。