Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.
 
 
 

64 linhas
1.3 KiB

  1. <template>
  2. <div class="cancel">
  3. <h1 v-if="!success">cancelling reservation {{$route.params.token}} ...</h1>
  4. <h1 v-else>
  5. Your reservation got cancelled.<br>
  6. thanks for letting us know!
  7. </h1>
  8. <div v-if="error">
  9. <h2>
  10. Oh no! sth went wrong.
  11. </h2>
  12. <p>
  13. {{error.detail}}
  14. </p>
  15. <p>
  16. please send us an email with your reservation token <span class="color: #0ff">{{$route.params.token}}</span>, so we can have a look at it:<br>
  17. reservation@ck.si
  18. </p>
  19. </div>
  20. </div>
  21. </template>
  22. <script>
  23. export default {
  24. name: 'Cancel',
  25. data() {
  26. return {
  27. success: false,
  28. error: false,
  29. }
  30. },
  31. methods: {
  32. async cancel() {
  33. let data = {
  34. token: this.$route.params.token
  35. }
  36. const response = await fetch(
  37. `http://localhost:1234/api/guest/cancel`, {
  38. method: 'POST',
  39. headers: { 'Content-Type': 'application/json' },
  40. body: JSON.stringify(data),
  41. }
  42. )
  43. if (response.status === 200) {
  44. this.success = true
  45. } else {
  46. this.error = await response.json()
  47. }
  48. }
  49. },
  50. mounted () {
  51. this.cancel()
  52. },
  53. }
  54. </script>
  55. <style>
  56. </style>