var vm = new Vue({
    el: '#app',
    data: {
        text: 'make ascii art',
        output: '',
        font: 'slant',
        fonts: [],
        yesno: '',
        yesnoimg: '',
        tagline: ''
    },
    created: function () {
        axios.get(
            'api/?fonts'
        ).then(function (response) {
            vm.fonts = response.data
        })
        this.getnewtagline()
        this.updateOutput()
    },
    methods: {
        updateOutput: function () {
            axios.get(
                'api/?text=' + this.text + '&font=' + this.font
            ).then(function (response) {
                vm.output = response.data
            })
        },
        getyesno: function () {
            axios.get(
                'https://yesno.wtf/api'
            ).then(function (response) {
                response = response.data
                vm.yesno = response.answer
                vm.yesnoimg = response.image
            })
        },
        getnewtagline: function () {
            axios.get('api/').then(function (response) {
                vm.tagline = response.data
            })
        }
    }
})
