github.com/peteretelej/iso8583@v0.0.0-20170605053616-4ee92c44e299/web/js/main.js (about) 1 var app = new Vue({ 2 el: "#app", 3 data: { 4 activeform: "bitmap", 5 value:"", 6 result:"", 7 }, 8 computed: { 9 placeholder:function(){ 10 switch(this.activeform){ 11 case "bitmap": 12 return "Enter Bitmap" 13 } 14 }, 15 formtitle: function(){ 16 switch(this.activeform){ 17 case "bitmap": 18 return "Convert bitmap to binary string" 19 } 20 } 21 }, 22 methods: { 23 bitmapToBinary: function(){ 24 if (this.value==""){ 25 newResult("Error: Enter a value into the form for conversion.") 26 return 27 } 28 newResult("(fetching result...)") 29 axios.get("/api/bitmaptobin",{ 30 params:{ 31 msg: this.value 32 } 33 }) 34 .then(function(response){ 35 newResult(response.data.data.Result) 36 }) 37 .catch(function(error){ 38 if (error.response.data.response===undefined){ 39 newResult("Oops! something went wrong. Confirm the value you submitted, must be hex bitmap.") 40 return 41 } 42 newResult("Error: "+ error.response.data.response+".") 43 }) 44 45 } 46 } 47 }) 48 49 function newResult(result){ 50 app.result = result 51 }