【发布时间】:2021-02-14 21:25:32
【问题描述】:
这里是代码,这里是我连接到“https://hub.graphistry.com/api-token-auth/”的 web api,我尝试使用 axios 但 id 没有帮助科斯
import React, { Component } from "react";
export default class App extends Component {
async postData() {
try {
let result = await fetch("https://hub.graphistry.com/api-token-auth/", {
method: "post",
mode: "no-cors",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify({
username: "orlando",
password: "graphistry1234",
}),
});
console.log(result);
} catch (e) {
console.log(e);
}
}
render() {
return (
<div>
<button onClick={() => this.postData()}>
Press me to post some data
</button>
</div>
);
}
}
【问题讨论】:
-
请不要将错误信息发布为图片。