actuel-inactuel/site/plugins/send-button/index.js

63 lines
1.9 KiB
JavaScript
Raw Normal View History

2024-10-16 08:53:53 +02:00
(function() {
"use strict";
function normalizeComponent(scriptExports, render, staticRenderFns, functionalTemplate, injectStyles, scopeId, moduleIdentifier, shadowMode) {
var options = typeof scriptExports === "function" ? scriptExports.options : scriptExports;
if (render) {
options.render = render;
options.staticRenderFns = staticRenderFns;
options._compiled = true;
}
{
options._scopeId = "data-v-" + scopeId;
}
return {
exports: scriptExports,
options
};
}
const _sfc_main = {
__name: "SendButtonField",
props: {
pageUri: String
},
setup(__props) {
const { pageUri } = __props;
const text = Vue.ref("Envoyer");
const headers = {
method: "POST",
body: JSON.stringify({
pageUri
})
};
function send(event) {
event.preventDefault();
fetch("/send-newsletter.json", headers).then((res) => res.json()).then((json) => console.log(json));
}
return { __sfc: true, text, headers, send };
}
};
var _sfc_render = function render() {
var _vm = this, _c = _vm._self._c, _setup = _vm._self._setupProxy;
return _c("k-button", { attrs: { "variant": "filled", "icon": "plane" }, on: { "click": function($event) {
return _setup.send($event);
} } }, [_vm._v(_vm._s(_setup.text))]);
};
var _sfc_staticRenderFns = [];
_sfc_render._withStripped = true;
var __component__ = /* @__PURE__ */ normalizeComponent(
_sfc_main,
_sfc_render,
_sfc_staticRenderFns,
false,
null,
"4847e765"
);
__component__.options.__file = "/Users/adrienpayet/code/actuel-inactuel/site/plugins/send-button/src/components/SendButtonField.vue";
const SendButtonField = __component__.exports;
window.panel.plugin("adrienpayet/send-button", {
fields: {
"send-button": SendButtonField
}
});
})();