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() {
|
||||
this.setState(null)
|
||||
fetch('/api/order' + '?order_id=' + this.orderId)
|
||||
.then((response) => response.json())
|
||||
.then((data) => {console.log(data) &
|
||||
// Unneeded for the most part. Let's keep variable names as they come from the API
|
||||
// Will need some renaming everywhere, but will decrease the mess.
|
||||
setStateCool=(data)=>{
|
||||
this.setState({
|
||||
loading: false,
|
||||
delay: this.setDelay(data.status),
|
||||
@ -118,7 +116,12 @@ export default class OrderPage extends Component {
|
||||
premiumPercentile: data.premium_percentile,
|
||||
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
|
||||
@ -197,9 +200,7 @@ export default class OrderPage extends Component {
|
||||
};
|
||||
fetch('/api/order/' + '?order_id=' + this.orderId, requestOptions)
|
||||
.then((response) => response.json())
|
||||
.then((data) => (this.setState({badRequest:data.bad_request})
|
||||
& console.log(data)
|
||||
& this.getOrderDetails(data.id)));
|
||||
.then((data) => this.setStateCool(data));
|
||||
}
|
||||
getCurrencyDict() {
|
||||
fetch('/static/assets/currencies.json')
|
||||
|
||||
@ -256,7 +256,7 @@ export default class TradeBox extends Component {
|
||||
<ListItemIcon>
|
||||
<SmartToyIcon/>
|
||||
</ListItemIcon>
|
||||
<ListItemText primary={'000 coming soon'} secondary="Robots looking at the book"/>
|
||||
<ListItemText primary={'coming soon'} secondary="Robots looking at the book"/>
|
||||
</ListItem>
|
||||
|
||||
<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(
|
||||
<Grid container spacing={1}>
|
||||
<Grid item xs={12} align="center">
|
||||
@ -548,11 +572,10 @@ handleRatingChange=(e)=>{
|
||||
</Grid>
|
||||
|
||||
<Chat orderId={this.props.data.id} urNick={this.props.data.urNick}/>
|
||||
|
||||
<Grid item xs={12} align="center">
|
||||
{openDisputeButton ? this.showOpenDisputeButton() : ""}
|
||||
{sendFiatButton ? this.showFiatSentButton() : ""}
|
||||
{receivedFiatButton ? this.showFiatReceivedButton() : ""}
|
||||
{showDisputeButton ? this.showOpenDisputeButton() : ""}
|
||||
{showSendButton ? this.showFiatSentButton() : ""}
|
||||
{showReveiceButton ? this.showFiatReceivedButton() : ""}
|
||||
</Grid>
|
||||
{this.showBondIsLocked()}
|
||||
</Grid>
|
||||
@ -605,13 +628,8 @@ handleRatingChange=(e)=>{
|
||||
{this.props.data.isBuyer & this.props.data.statusCode == 7 ? this.showWaitingForEscrow() : ""}
|
||||
{this.props.data.isSeller & this.props.data.statusCode == 8 ? this.showWaitingForBuyerInvoice() : ""}
|
||||
|
||||
{/* In Chatroom - No fiat sent - showChat(showSendButton, showReveiceButton, showDisputeButton) */}
|
||||
{this.props.data.isBuyer & this.props.data.statusCode == 9 ? this.showChat(true,false,true) : ""}
|
||||
{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) : ""}
|
||||
{/* In Chatroom */}
|
||||
{this.props.data.statusCode == 9 || this.props.data.statusCode == 10 ? this.showChat(): ""}
|
||||
|
||||
{/* Trade Finished */}
|
||||
{(this.props.data.isSeller & this.props.data.statusCode > 12 & this.props.data.statusCode < 15) ? this.showRateSelect() : ""}
|
||||
|
||||
Reference in New Issue
Block a user