actuel-inactuel/site/plugins/send-button/src/components/SendButtonField.vue

38 lines
629 B
Vue
Raw Normal View History

2024-10-16 08:53:53 +02:00
<template>
<k-button @click="send($event)" variant="filled" icon="plane">{{
text
}}</k-button>
</template>
<script setup>
import { ref } from "vue";
const { pageUri } = defineProps({
pageUri: String,
});
const text = ref("Envoyer");
const headers = {
method: "POST",
body: JSON.stringify({
pageUri,
}),
};
2025-01-28 13:10:11 +01:00
async function send(event) {
2024-10-16 08:53:53 +02:00
event.preventDefault();
2025-01-28 13:10:11 +01:00
const response = await fetch("/send-newsletter.json", headers);
const data = await response.json();
console.log(data);
2024-10-16 08:53:53 +02:00
}
</script>
<style scoped>
@media screen and (min-width: 533px) {
button {
margin-top: 2.15rem;
}
}
</style>