@eotl/core
Version:
Assortment of data structures, Vue.js components, and utilities across EOTL apps and sites.
118 lines (117 loc) • 4.36 kB
JavaScript
import { ssrFetcher, ssrIdentity } from "@eotl/simple-signed-records";
import { useEotlCore } from "./store.js";
import { u as useAuthSsr } from "./authSsr-BedulHkH.js";
import { openBlock, createElementBlock, createElementVNode, withDirectives, vModelText, Fragment, renderList, toDisplayString, vModelSelect } from "vue";
import { _ as _export_sfc } from "./_plugin-vue_export-helper-1tPrXgE0.js";
const _sfc_main = {
name: "AccountNew",
data() {
const store = useEotlCore();
useAuthSsr();
return {
store,
invite_code: "",
name: "",
account_type: "person"
};
},
methods: {
btnAccountCreate() {
if (this.invite_code) {
let vm = this;
let router = this.$router;
let invite = { invite_code: this.invite_code };
ssrFetcher.Post("invites/use", invite).then((data) => {
vm.invite_code = "";
if (!data.error) {
let status = "active";
let secretKey = vm.authSsr.identity.secretKey;
let publicKey = vm.authSsr.identity.publicKey;
let cert = ssrIdentity.generateCert({ secretKey, publicKey });
vm.store.dispatch("restoreAccount", {
status,
cert
});
router.push({ path: "new" });
} else {
let show = true;
let style = "warning";
let title = "Dang";
let message = data.description;
vm.store.dispatch("alertMsg", {
show,
style,
title,
message
});
}
});
}
}
}
};
const _hoisted_1 = /* @__PURE__ */ createElementVNode("p", null, "You must have an invite token for your shipment to be processed.", -1);
const _hoisted_2 = { class: "form-group" };
const _hoisted_3 = /* @__PURE__ */ createElementVNode("label", null, "Invite Token", -1);
const _hoisted_4 = { class: "form-group" };
const _hoisted_5 = /* @__PURE__ */ createElementVNode("label", null, "Name", -1);
const _hoisted_6 = { class: "form-group" };
const _hoisted_7 = /* @__PURE__ */ createElementVNode("label", null, "You are", -1);
const _hoisted_8 = ["value"];
const _hoisted_9 = { class: "form-group" };
const _hoisted_10 = /* @__PURE__ */ createElementVNode("label", null, null, -1);
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
return openBlock(), createElementBlock("div", null, [
_hoisted_1,
createElementVNode("div", _hoisted_2, [
_hoisted_3,
withDirectives(createElementVNode("input", {
type: "text",
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => $data.invite_code = $event),
class: "form-control",
placeholder: "tree badger honey good"
}, null, 512), [
[vModelText, $data.invite_code]
])
]),
createElementVNode("div", _hoisted_4, [
_hoisted_5,
withDirectives(createElementVNode("input", {
type: "text",
"onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => $data.name = $event),
class: "form-control",
placeholder: "David Buckle"
}, null, 512), [
[vModelText, $data.name]
])
]),
createElementVNode("div", _hoisted_6, [
_hoisted_7,
withDirectives(createElementVNode("select", {
"onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => $data.account_type = $event),
class: "form-control"
}, [
(openBlock(true), createElementBlock(Fragment, null, renderList($data.store.config.account_types, (type) => {
return openBlock(), createElementBlock("option", {
key: type,
value: type
}, toDisplayString(_ctx.$t("accountTypes." + type)), 9, _hoisted_8);
}), 128))
], 512), [
[vModelSelect, $data.account_type]
])
]),
createElementVNode("div", _hoisted_9, [
_hoisted_10,
createElementVNode("button", {
onClick: _cache[3] || (_cache[3] = (...args) => $options.btnAccountCreate && $options.btnAccountCreate(...args)),
class: "btn btn-primary btn-block"
}, " Create Your First Shipment ")
])
]);
}
const AccountNew = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
export {
AccountNew as A
};
//# sourceMappingURL=AccountNew-C3Kon05d.js.map