UNPKG

@scalar/api-client

Version:

the open source API testing client

61 lines (60 loc) 2.6 kB
import { defineComponent as f, createElementBlock as h, openBlock as a, createElementVNode as o, createBlock as y, createCommentVNode as S, createVNode as x, unref as e, normalizeClass as _ } from "vue"; import { ScalarToggle as C } from "@scalar/components"; import { useActiveEntities as V } from "../../store/active-entities.js"; import { useWorkspace as g } from "../../store/store.js"; import k from "../Request/RequestSection/RequestAuth/RequestAuth.vue.js"; const b = { class: "flex h-full w-full flex-col gap-12 px-1.5 pt-8" }, w = { class: "flex flex-col gap-4" }, A = { class: "flex flex-col gap-2" }, E = { class: "flex h-8 items-center justify-between" }, j = /* @__PURE__ */ f({ __name: "CollectionAuthentication", setup(U) { const { activeCollection: t, activeEnvVariables: u, activeEnvironment: d, activeServer: m, activeWorkspace: c } = V(), { collectionMutators: p } = g(), v = () => { var i; (i = t.value) != null && i.uid && p.edit( t.value.uid, "useCollectionSecurity", !t.value.useCollectionSecurity ); }; return (i, l) => { var n, s, r; return a(), h("div", b, [ o("div", w, [ o("div", A, [ o("div", E, [ l[0] || (l[0] = o("h3", { class: "font-bold" }, "Authentication", -1)), x(e(C), { class: "w-4", modelValue: ((n = e(t)) == null ? void 0 : n.useCollectionSecurity) ?? !1, "onUpdate:modelValue": v }, null, 8, ["modelValue"]) ]), l[1] || (l[1] = o("p", { class: "pr-6 text-sm" }, " Added authentication will apply to all requests under this collection. You can override this by specifying another one in the request. ", -1)) ]), e(t) && e(c) ? (a(), y(e(k), { key: 0, class: _([ "scalar-collection-auth", !((s = e(t)) != null && s.useCollectionSecurity) && "pointer-events-none opacity-50 mix-blend-luminosity" ]), collection: e(t), envVariables: e(u), environment: e(d), layout: "client", selectedSecuritySchemeUids: ((r = e(t)) == null ? void 0 : r.selectedSecuritySchemeUids) ?? [], server: e(m), title: "Authentication", workspace: e(c) }, null, 8, ["class", "collection", "envVariables", "environment", "selectedSecuritySchemeUids", "server", "workspace"])) : S("", !0) ]) ]); }; } }); export { j as default };