Peer url updated

This commit is contained in:
raja.blaze 2019-08-16 18:36:07 +05:30
parent 5fc8a380fb
commit 3d9cf6c292
3 changed files with 21 additions and 4 deletions

View File

@ -559,7 +559,12 @@ export class BlockchainKernelController {
) => {
var self = this;
try {
http.get('http://116.203.152.58:13413/v1/peers/connected',
if(Global.network == "Floonet"){
var peer_url = process.env.FLOONET_PEER_URL;
}else{
var peer_url = process.env.TESTNET_PEER_URL;
}
http.get(peer_url,
async (resp) => {
// console.log('resp resp respresp',resp);
let data = '';

View File

@ -10,7 +10,11 @@ export function validationMiddleware<T>(
skipMissingProperties = false,
): express.RequestHandler {
return (request: Request, response: Response, next: NextFunction) => {
if(request.headers.network){
Global.network = request.headers.network;
}else{
Global.network = 'Floonet';
}
validate(
plainToClass(type, {
...request.body,

View File

@ -101,9 +101,17 @@ export class LatestblocksComponent implements OnInit {
if (res['status'] == 200) {
let json = res.response.dataJson;
if(json && json.length > 0){
localStorage.setItem('peersJson',JSON.stringify(json));
if(localStorage.getItem('network') == "Testnet"){
localStorage.setItem('peersJson_Testnet',JSON.stringify(json));
}else{
localStorage.setItem('peersJson_Floonet',JSON.stringify(json));
}
}
if(localStorage.getItem('network') == "Testnet"){
this.peers = JSON.parse(localStorage.getItem('peersJson_Testnet'));
}else{
this.peers = JSON.parse(localStorage.getItem('peersJson_Floonet'));
}
this.peers = JSON.parse(localStorage.getItem('peersJson'));
}
},
error => {},