@eotl/core
Version:
Assortment of data structures, Vue.js components, and utilities across EOTL apps and sites.
114 lines (113 loc) • 4.43 kB
JavaScript
import { ssrFetcher, ssrIdentity } from "@eotl/simple-signed-records";
import { useEotlCore } from "./store.js";
import { openBlock, createElementBlock, createElementVNode, withDirectives, vModelText, Fragment, renderList, createTextVNode, toDisplayString } from "vue";
import { _ as _export_sfc } from "./_plugin-vue_export-helper-1tPrXgE0.js";
const _sfc_main = {
components: {},
data: function() {
const store = useEotlCore();
return {
store,
invites: [],
new_invite_code: ""
};
},
created() {
let vm = this;
ssrFetcher.Get("invites").then((data) => {
vm.invites = data;
});
},
methods: {
btnGenerateInvite() {
const invite = ssrIdentity.generateInvite();
this.new_invite_code = invite.join(" ");
},
btnCreateInvite() {
let vm = this;
let invite = { invite_code: this.new_invite_code };
ssrFetcher.Post("invites", invite).then((data) => {
vm.invites.push(data);
vm.new_invite_code = "";
});
}
}
};
const _hoisted_1 = /* @__PURE__ */ createElementVNode("h2", { class: "mb-3" }, "Invites", -1);
const _hoisted_2 = /* @__PURE__ */ createElementVNode("hr", { class: "thick mb-5" }, null, -1);
const _hoisted_3 = /* @__PURE__ */ createElementVNode("p", null, "Invite tokens are used to allow new accounts to be automatically verified. You can manually give these tokens, print them, or other automated sending methods.", -1);
const _hoisted_4 = { class: "row" };
const _hoisted_5 = { class: "col-6" };
const _hoisted_6 = { class: "col-3" };
const _hoisted_7 = { class: "col-3" };
const _hoisted_8 = /* @__PURE__ */ createElementVNode("hr", { class: "mt-5 mb-5" }, null, -1);
const _hoisted_9 = /* @__PURE__ */ createElementVNode("h4", null, "Existing Invites", -1);
const _hoisted_10 = { class: "list-unstyled" };
const _hoisted_11 = { class: "row" };
const _hoisted_12 = { class: "col-6" };
const _hoisted_13 = ["value"];
const _hoisted_14 = { class: "col-6" };
const _hoisted_15 = /* @__PURE__ */ createElementVNode("br", null, null, -1);
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
return openBlock(), createElementBlock("div", null, [
_hoisted_1,
_hoisted_2,
_hoisted_3,
createElementVNode("div", _hoisted_4, [
createElementVNode("div", _hoisted_5, [
withDirectives(createElementVNode("input", {
type: "text",
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => _ctx.new_invite_code = $event),
class: "form-control",
placeholder: "type custom invite words"
}, null, 512), [
[vModelText, _ctx.new_invite_code]
])
]),
createElementVNode("div", _hoisted_6, [
createElementVNode("button", {
onClick: _cache[1] || (_cache[1] = (...args) => $options.btnGenerateInvite && $options.btnGenerateInvite(...args)),
class: "btn btn-secondary btn-block"
}, " Generate ")
]),
createElementVNode("div", _hoisted_7, [
createElementVNode("button", {
onClick: _cache[2] || (_cache[2] = (...args) => $options.btnCreateInvite && $options.btnCreateInvite(...args)),
class: "btn btn-primary btn-block"
}, " Create Invite ")
])
]),
_hoisted_8,
_hoisted_9,
createElementVNode("ul", _hoisted_10, [
(openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.invites, (invite) => {
return openBlock(), createElementBlock("li", {
key: invite.id,
class: "mt-5 mb-5"
}, [
createElementVNode("div", _hoisted_11, [
createElementVNode("div", _hoisted_12, [
createElementVNode("input", {
value: invite.invite_code,
readonly: "",
class: "form-control"
}, null, 8, _hoisted_13)
]),
createElementVNode("div", _hoisted_14, [
createElementVNode("small", null, [
createTextVNode(" ID: " + toDisplayString(invite.id), 1),
_hoisted_15,
createTextVNode(" Identity: " + toDisplayString(invite.invite_key_id), 1)
])
])
])
]);
}), 128))
])
]);
}
const Invites = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
export {
Invites as default
};
//# sourceMappingURL=Invites-fFnUULpP.js.map