Created
September 27, 2018 08:35
-
-
Save WietseWind/93d189688836900021ed945a014de498 to your computer and use it in GitHub Desktop.
Simple Ripple DATA API Validator stats in Vue webpage
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<template> | |
<div> | |
Hi, this is {{ appName }} | |
<hr /> | |
<div v-if="!validatorData.reports"> | |
Loading... | |
</div> | |
<div v-else> | |
{{ validatorData.count }} reports; | |
<br /><br /> | |
<table> | |
<thead> | |
<tr> | |
<th>Date</th> | |
<th>Ledgers</th> | |
<th>Agreement</th> | |
</tr> | |
</thead> | |
<tbody> | |
<tr v-for="r in validatorData.reports" v-bind:key="r.date"> | |
<td>{{ new Date(Date.parse(r.date)).toString() }}</td> | |
<td>{{ r.main_net_ledgers }}</td> | |
<td>{{ r.main_net_agreement }}</td> | |
</tr> | |
</tbody> | |
</table> | |
</div> | |
</div> | |
</template> | |
<script> | |
export default { | |
name: 'App', | |
data () { | |
return { | |
appName: "SampleApp", | |
validatorData: {} | |
} | |
}, | |
mounted () { | |
window.fetch('https://data.ripple.com/v2/network/validators/nHUcQnmEbCNq4uhntFudzfrZV8P5WLoBrR5h3R9jAd621Aaz1pSy/reports').then(r => { | |
return r.json() | |
}).then(data => { | |
// Set it to the Vue App data | |
this.validatorData = data | |
}) | |
} | |
} | |
</script> | |
<style> | |
* { font-family: Arial, monospace; } | |
</style> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment