Skouter mortgage estimates. Web application with view written in PHP and Vue, but controller and models in Go.
25'ten fazla konu seçemezsiniz Konular bir harf veya rakamla başlamalı, kısa çizgiler ('-') içerebilir ve en fazla 35 karakter uzunluğunda olabilir.

unsubscribe.vue 644 B

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