<template>
    <div id="admin">
        <p v-show="apiDone">Current balance: {{balance}}</p>
        <textarea name="payreqRedeem"></textarea>
        <button name="redeem">Redeem</button>
    </div>
</template>

<script>
import Api from './api.js'

export default {
    name: 'AdminView',
    data(){
        return {
            balance: 0,
            apiDone: false,
        }
    },
    props: ['adminToken'],
    created(){
        let self = this
        Api.adminInfo(this.adminToken)
            .then((res)=>{
                res.json().then((data)=>{
                self.balance = data.msat_avail
                self.apiDone = true
            })
        })
    }
}
</script>
