Skouter mortgage estimates. Web application with view written in PHP and Vue, but controller and models in Go.
 
 
 
 
 
 

31 lines
697 B

  1. <template>
  2. <Dialog @close="() => $emit('close')">
  3. <h3>
  4. Are you sure you want to {{cancelAtEnd ? "subscribe" : "unsubscribe"}}?
  5. </h3>
  6. <button @click="() => $emit('close')">Cancel</button>
  7. <button @click="unsubscribe">Confirm</button>
  8. </Dialog>
  9. </template>
  10. <script setup>
  11. import Dialog from "./dialog.vue"
  12. const emit = defineEmits(['close', 'cancelSub'])
  13. const props = defineProps(['token', 'cancelAtEnd'])
  14. function unsubscribe() {
  15. fetch(`/api/user/unsubscribe`,
  16. {method: 'GET',
  17. headers: {
  18. "Accept": "application/json",
  19. "Authorization": `Bearer ${props.token}`,
  20. },
  21. }).then(resp => {
  22. if (resp.ok) emit('cancelSub')
  23. })
  24. }
  25. </script>