UNPKG

@eotl/core

Version:

Assortment of data structures, Vue.js components, and utilities across EOTL apps and sites.

117 lines (116 loc) 4.45 kB
"use strict"; const simpleSignedRecords = require("@eotl/simple-signed-records"); const store = require("./store.cjs"); const authSsr = require("./authSsr-Aa_pi4mF.cjs"); const vue = require("vue"); const _pluginVue_exportHelper = require("./_plugin-vue_export-helper-DM9IkUGy.cjs"); const _sfc_main = { name: "AccountNew", data() { const store$1 = store.useEotlCore(); authSsr.useAuthSsr(); return { store: store$1, 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 }; simpleSignedRecords.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 = simpleSignedRecords.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__ */ vue.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__ */ vue.createElementVNode("label", null, "Invite Token", -1); const _hoisted_4 = { class: "form-group" }; const _hoisted_5 = /* @__PURE__ */ vue.createElementVNode("label", null, "Name", -1); const _hoisted_6 = { class: "form-group" }; const _hoisted_7 = /* @__PURE__ */ vue.createElementVNode("label", null, "You are", -1); const _hoisted_8 = ["value"]; const _hoisted_9 = { class: "form-group" }; const _hoisted_10 = /* @__PURE__ */ vue.createElementVNode("label", null, null, -1); function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) { return vue.openBlock(), vue.createElementBlock("div", null, [ _hoisted_1, vue.createElementVNode("div", _hoisted_2, [ _hoisted_3, vue.withDirectives(vue.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), [ [vue.vModelText, $data.invite_code] ]) ]), vue.createElementVNode("div", _hoisted_4, [ _hoisted_5, vue.withDirectives(vue.createElementVNode("input", { type: "text", "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => $data.name = $event), class: "form-control", placeholder: "David Buckle" }, null, 512), [ [vue.vModelText, $data.name] ]) ]), vue.createElementVNode("div", _hoisted_6, [ _hoisted_7, vue.withDirectives(vue.createElementVNode("select", { "onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => $data.account_type = $event), class: "form-control" }, [ (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList($data.store.config.account_types, (type) => { return vue.openBlock(), vue.createElementBlock("option", { key: type, value: type }, vue.toDisplayString(_ctx.$t("accountTypes." + type)), 9, _hoisted_8); }), 128)) ], 512), [ [vue.vModelSelect, $data.account_type] ]) ]), vue.createElementVNode("div", _hoisted_9, [ _hoisted_10, vue.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__ */ _pluginVue_exportHelper._export_sfc(_sfc_main, [["render", _sfc_render]]); exports.AccountNew = AccountNew; //# sourceMappingURL=AccountNew-iEKG4C1F.cjs.map