Created
September 4, 2017 09:32
-
-
Save Attila03/3398c4a3c55a9812211274d2cb61b761 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<template> | |
<div id="register-tournament"> | |
<input type="text" v-model="tournamentName"/> | |
<button type="button" v-on:click="createTournament">Create Tournament</button> | |
</div> | |
</template> | |
<script> | |
import axios from 'axios'; | |
export default { | |
data: function(){ | |
return { | |
'tournamentName': '', | |
} | |
}, | |
methods: { | |
createTournament: function(){ | |
axios.post("http://127.0.0.1:8000/api/tournaments/", { | |
data: { | |
"name": this.tournamentName | |
}, | |
// headers:{ | |
// 'authorization': 'Basic YXR0aWxhOmFkaXR5YTEyMw==' The encoded form was obtained using Postman(just for testing). | |
// }, | |
auth: { | |
username: 'username', | |
password: 'password' | |
} | |
}) | |
} | |
} | |
} | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment