mirror of
https://github.com/RoboSats/robosats.git
synced 2025-09-13 00:56:22 +00:00
Fix chat reloading after confirming fiat sent
This commit is contained in:
@ -73,11 +73,9 @@ export default class OrderPage extends Component {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
getOrderDetails() {
|
// Unneeded for the most part. Let's keep variable names as they come from the API
|
||||||
this.setState(null)
|
// Will need some renaming everywhere, but will decrease the mess.
|
||||||
fetch('/api/order' + '?order_id=' + this.orderId)
|
setStateCool=(data)=>{
|
||||||
.then((response) => response.json())
|
|
||||||
.then((data) => {console.log(data) &
|
|
||||||
this.setState({
|
this.setState({
|
||||||
loading: false,
|
loading: false,
|
||||||
delay: this.setDelay(data.status),
|
delay: this.setDelay(data.status),
|
||||||
@ -118,7 +116,12 @@ export default class OrderPage extends Component {
|
|||||||
premiumPercentile: data.premium_percentile,
|
premiumPercentile: data.premium_percentile,
|
||||||
numSimilarOrders: data.num_similar_orders
|
numSimilarOrders: data.num_similar_orders
|
||||||
})
|
})
|
||||||
});
|
}
|
||||||
|
getOrderDetails() {
|
||||||
|
this.setState(null)
|
||||||
|
fetch('/api/order' + '?order_id=' + this.orderId)
|
||||||
|
.then((response) => response.json())
|
||||||
|
.then((data) => this.setStateCool(data));
|
||||||
}
|
}
|
||||||
|
|
||||||
// These are used to refresh the data
|
// These are used to refresh the data
|
||||||
@ -197,9 +200,7 @@ export default class OrderPage extends Component {
|
|||||||
};
|
};
|
||||||
fetch('/api/order/' + '?order_id=' + this.orderId, requestOptions)
|
fetch('/api/order/' + '?order_id=' + this.orderId, requestOptions)
|
||||||
.then((response) => response.json())
|
.then((response) => response.json())
|
||||||
.then((data) => (this.setState({badRequest:data.bad_request})
|
.then((data) => this.setStateCool(data));
|
||||||
& console.log(data)
|
|
||||||
& this.getOrderDetails(data.id)));
|
|
||||||
}
|
}
|
||||||
getCurrencyDict() {
|
getCurrencyDict() {
|
||||||
fetch('/static/assets/currencies.json')
|
fetch('/static/assets/currencies.json')
|
||||||
|
|||||||
@ -256,7 +256,7 @@ export default class TradeBox extends Component {
|
|||||||
<ListItemIcon>
|
<ListItemIcon>
|
||||||
<SmartToyIcon/>
|
<SmartToyIcon/>
|
||||||
</ListItemIcon>
|
</ListItemIcon>
|
||||||
<ListItemText primary={'000 coming soon'} secondary="Robots looking at the book"/>
|
<ListItemText primary={'coming soon'} secondary="Robots looking at the book"/>
|
||||||
</ListItem>
|
</ListItem>
|
||||||
|
|
||||||
<Divider/>
|
<Divider/>
|
||||||
@ -526,7 +526,31 @@ handleRatingChange=(e)=>{
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
showChat(sendFiatButton, receivedFiatButton, openDisputeButton){
|
showChat=()=>{
|
||||||
|
//In Chatroom - No fiat sent - showChat(showSendButton, showReveiceButton, showDisputeButton)
|
||||||
|
if(this.props.data.isBuyer & this.props.data.statusCode == 9){
|
||||||
|
var showSendButton=true;
|
||||||
|
var showReveiceButton=false;
|
||||||
|
var showDisputeButton=true;
|
||||||
|
}
|
||||||
|
if(this.props.data.isSeller & this.props.data.statusCode == 9){
|
||||||
|
var showSendButton=false;
|
||||||
|
var showReveiceButton=false;
|
||||||
|
var showDisputeButton=true;
|
||||||
|
}
|
||||||
|
|
||||||
|
//In Chatroom - Fiat sent - showChat(showSendButton, showReveiceButton, showDisputeButton)
|
||||||
|
if(this.props.data.isBuyer & this.props.data.statusCode == 10){
|
||||||
|
var showSendButton=false;
|
||||||
|
var showReveiceButton=false;
|
||||||
|
var showDisputeButton=true;
|
||||||
|
}
|
||||||
|
if(this.props.data.isSeller & this.props.data.statusCode == 10){
|
||||||
|
var showSendButton=false;
|
||||||
|
var showReveiceButton=true;
|
||||||
|
var showDisputeButton=true;
|
||||||
|
}
|
||||||
|
|
||||||
return(
|
return(
|
||||||
<Grid container spacing={1}>
|
<Grid container spacing={1}>
|
||||||
<Grid item xs={12} align="center">
|
<Grid item xs={12} align="center">
|
||||||
@ -548,11 +572,10 @@ handleRatingChange=(e)=>{
|
|||||||
</Grid>
|
</Grid>
|
||||||
|
|
||||||
<Chat orderId={this.props.data.id} urNick={this.props.data.urNick}/>
|
<Chat orderId={this.props.data.id} urNick={this.props.data.urNick}/>
|
||||||
|
|
||||||
<Grid item xs={12} align="center">
|
<Grid item xs={12} align="center">
|
||||||
{openDisputeButton ? this.showOpenDisputeButton() : ""}
|
{showDisputeButton ? this.showOpenDisputeButton() : ""}
|
||||||
{sendFiatButton ? this.showFiatSentButton() : ""}
|
{showSendButton ? this.showFiatSentButton() : ""}
|
||||||
{receivedFiatButton ? this.showFiatReceivedButton() : ""}
|
{showReveiceButton ? this.showFiatReceivedButton() : ""}
|
||||||
</Grid>
|
</Grid>
|
||||||
{this.showBondIsLocked()}
|
{this.showBondIsLocked()}
|
||||||
</Grid>
|
</Grid>
|
||||||
@ -605,13 +628,8 @@ handleRatingChange=(e)=>{
|
|||||||
{this.props.data.isBuyer & this.props.data.statusCode == 7 ? this.showWaitingForEscrow() : ""}
|
{this.props.data.isBuyer & this.props.data.statusCode == 7 ? this.showWaitingForEscrow() : ""}
|
||||||
{this.props.data.isSeller & this.props.data.statusCode == 8 ? this.showWaitingForBuyerInvoice() : ""}
|
{this.props.data.isSeller & this.props.data.statusCode == 8 ? this.showWaitingForBuyerInvoice() : ""}
|
||||||
|
|
||||||
{/* In Chatroom - No fiat sent - showChat(showSendButton, showReveiceButton, showDisputeButton) */}
|
{/* In Chatroom */}
|
||||||
{this.props.data.isBuyer & this.props.data.statusCode == 9 ? this.showChat(true,false,true) : ""}
|
{this.props.data.statusCode == 9 || this.props.data.statusCode == 10 ? this.showChat(): ""}
|
||||||
{this.props.data.isSeller & this.props.data.statusCode == 9 ? this.showChat(false,false,true) : ""}
|
|
||||||
|
|
||||||
{/* In Chatroom - Fiat sent - showChat(showSendButton, showReveiceButton, showDisputeButton) */}
|
|
||||||
{this.props.data.isBuyer & this.props.data.statusCode == 10 ? this.showChat(false,false,true) : ""}
|
|
||||||
{this.props.data.isSeller & this.props.data.statusCode == 10 ? this.showChat(false,true,true) : ""}
|
|
||||||
|
|
||||||
{/* Trade Finished */}
|
{/* Trade Finished */}
|
||||||
{(this.props.data.isSeller & this.props.data.statusCode > 12 & this.props.data.statusCode < 15) ? this.showRateSelect() : ""}
|
{(this.props.data.isSeller & this.props.data.statusCode > 12 & this.props.data.statusCode < 15) ? this.showRateSelect() : ""}
|
||||||
|
|||||||
Reference in New Issue
Block a user