所以我正在做一个使用Axioswith的项目Json-server,但是我有一个问题,每次我做 aPatch时,我都必须在主页上给 F5 以更新它,我想知道我该怎么做才能让它不会发生,并自动。
我的Patch:
onSubmitDate = event => {
const newUrl = prompt("Please with new URL:");
const personCurrent = event.target.value;
axios.patch(`http://localhost:3004/employee/${personCurrent}`, {
url_git: newUrl
})
.then(response => {
console.log(response);
})
.catch(error => {
console.log(error);
});
}
我的Get:
componentDidMount() {
axios
.get("http://127.0.0.1:3004/employee")
.then(response => this.setState({ employee: response.data }));
}
有人可以帮助我吗?