examine whether logged before claim

This commit is contained in:
starlee 2021-11-18 09:00:59 +08:00
parent e8a658aa87
commit dcfcca5799
2 changed files with 19 additions and 14 deletions

View File

@ -317,7 +317,7 @@ class Detail extends Component {
<div className="list-left list-left-padding">
<div className="list-right-item-padding background-f boder-4">
<Claims issue_id={orderId}/>
<Claims issue_id={orderId} {...this.props} />
{/* <h1>hello in h1</h1> */}
</div>

View File

@ -17,7 +17,7 @@ class claims extends React.Component {
}
getClaimers = ()=>{
const {issue_id} = this.state;
axios.get(`/issues/${issue_id}/claims`)
axios.get(`/issues/${issue_id}/claims.json`)
.then((result) => {
if(result){
console.log(result.data),
@ -32,19 +32,24 @@ class claims extends React.Component {
}
claimFun = (flag) => {
const {issue_id} = this.state;
axios({
method: flag==1? 'delete' : 'post',
url: `/issues/${issue_id}/claims`
}).then(result => {
this.setState({
claimerdata: result.data.claimers,
currentUserClaimed: result.data.currentUserclaimed
if (this.props.checkIfLogin() === false) {
this.props.showLoginDialog();
return;
} else {
const {issue_id} = this.state;
axios({
method: flag==1? 'delete' : 'post',
url: `/issues/${issue_id}/claims.json`
}).then(result => {
this.setState({
claimerdata: result.data.claimers,
currentUserClaimed: result.data.currentUserclaimed
});
})
.catch(error => {
console.log(error);
});
})
.catch(error => {
console.log(error);
});
}
}
componentDidMount = () => {