Guest User

Untitled

a guest
Aug 13th, 2018
2,166
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. let vm = new Vue({
  2.     el: "#container",
  3.     data: {
  4.         newPerson: {
  5.             firstName: '',
  6.             lastName: ''
  7.         }
  8.     },
  9.     methods: {
  10.         sendIdentity: async function() {
  11.             try {
  12.                 const {data} = await axios.post('https://www.petario.com/test.php', this.newPerson);
  13.                 console.log(data);
  14.             } catch(e) {
  15.                 console.log(e);
  16.             }
  17.         },
  18.         toFormData: function(obj) {
  19.             let formData = new FormData();
  20.             for(let key in obj) {
  21.                 formData.append(key, obj[key]);
  22.             }
  23.             return formData;
  24.         }
  25.     }
  26. });
Add Comment
Please, Sign In to add comment