Web API 已在 .Net 中使用 Windows 身份验证创建。当我在 React APP 中调用 API 时得到 401 Unauthorized。Web API 在具有 Windows 身份验证的浏览器中工作正常。
axios.get('http://.../.../user/Data')
.then(function (response) {
console.log(response);
})
.catch(function (error) {
console.log(error);
});```
Run Code Online (Sandbox Code Playgroud) 我想要一个函数定义,其中应包含可选参数和其余参数。调用该函数时,我没有从该函数获得所需的输出。在调用函数时我应该使用一些特殊的关键字还是其他东西?
在下面的函数中,地址是可选参数,名称是其余参数。我怎样才能调用这个函数?
function Greet(age:number,address?:string,...names: string[]):void{
console.log(age);
console.log(address);
console.log(names)
}
Greet(20,"Mathan","Maddy")
Run Code Online (Sandbox Code Playgroud)
这里仅将参数传递给年龄和姓名。但第二个值“Mathan”正在考虑作为我的函数中的地址。