JSFiddle - React, Tailwind, and code Playground

by gakaki

HTML

<div id="app">

</div>

JavaScript

/* http://base62.net/ */

var app = new Vue({
    el: "#app",
    data: {
        encoded: "Encoding...",
        decoded: "Decoding...",
        error: null
    },
    created: function () {
        var self = this
        axios
            .post("https://api.base62.io/encode", {data: "Hello world!"})
            .then(function (response) {
                self.encoded = response.data.encoded
            })
            .catch(function (error) {
                self.error = "Could not reach the API: " + error
            })

        axios
            .post("https://api.base62.io/decode", {data: "T8dgcjRGuYUueWht"})
            .then(function (response) {
                self.decoded = response.data.decoded
            })
            .catch(function (error) {
                self.error = "Could not reach the API: " + error
            })
    }
});