Skip to content

Instantly share code, notes, and snippets.

@Attila03
Created September 4, 2017 09:32
Show Gist options
  • Save Attila03/3398c4a3c55a9812211274d2cb61b761 to your computer and use it in GitHub Desktop.
Save Attila03/3398c4a3c55a9812211274d2cb61b761 to your computer and use it in GitHub Desktop.
<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