Advertisement
Guest User

Untitled

a guest
Feb 25th, 2018
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.16 KB | None | 0 0
  1. <template>
  2. <div class="add container">
  3. <Alert v-if="alert" v-bind:message="alert" />
  4. <h1 class="page-header">Join game</h1>
  5. <form v-on:submit="CreateGame">
  6. <div class="well">
  7. <label>Generate a game code</label>
  8.  
  9. </div>
  10. <button type="submit" class="btn btn-primary">Join</button>
  11. </form>
  12. </div>
  13. </template>
  14.  
  15. <script>
  16. import Alert from './Alert'
  17. export default {
  18. name: 'add',
  19. data () {
  20. return {
  21. alert:''
  22. }
  23. },
  24. methods: {
  25. CreateGame(e){
  26. let requestData = {Action: "CreateGame",}
  27. console.log(requestData);
  28. this.$http.post('http://localhost:8080', requestData)
  29. .then(function(response){
  30. console.log(response.body.Code);
  31. //this.$router.push({path: '/lobby', query: {alert: 'Created new game'}});
  32. });
  33. e.preventDefault();
  34. }
  35. },
  36. components: {
  37. Alert
  38. }
  39. }
  40. </script>
  41.  
  42. <!-- Add "scoped" attribute to limit CSS to this component only -->
  43. <style scoped>
  44.  
  45. </style>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement