@scalar/api-client
Version:
the open source API testing client
57 lines (56 loc) • 2.4 kB
JavaScript
import { defineComponent as d, createElementBlock as m, openBlock as c, createElementVNode as o, createBlock as p, createCommentVNode as v, createVNode as f, unref as e, normalizeClass as h } from "vue";
import { ScalarToggle as y } from "@scalar/components";
import { useActiveEntities as S } from "../../store/active-entities.js";
import { useWorkspace as x } from "../../store/store.js";
import _ from "../Request/RequestSection/RequestAuth/RequestAuth.vue.js";
const C = { class: "flex h-full w-full flex-col gap-12 px-1.5 pt-8" }, V = { class: "flex flex-col gap-4" }, g = { class: "flex flex-col gap-2" }, k = { class: "flex h-8 items-center justify-between" }, N = /* @__PURE__ */ d({
__name: "CollectionAuthentication",
setup(b) {
const {
activeCollection: t,
activeEnvVariables: n,
activeEnvironment: s,
activeServer: r,
activeWorkspace: i
} = S(), { collectionMutators: a } = x(), u = () => {
t.value?.uid && a.edit(
t.value.uid,
"useCollectionSecurity",
!t.value.useCollectionSecurity
);
};
return (w, l) => (c(), m("div", C, [
o("div", V, [
o("div", g, [
o("div", k, [
l[0] || (l[0] = o("h3", { class: "font-bold" }, "Authentication", -1)),
f(e(y), {
class: "w-4",
modelValue: e(t)?.useCollectionSecurity ?? !1,
"onUpdate:modelValue": u
}, 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(i) ? (c(), p(e(_), {
key: 0,
class: h([
"scalar-collection-auth",
!e(t)?.useCollectionSecurity && "pointer-events-none opacity-50 mix-blend-luminosity"
]),
collection: e(t),
envVariables: e(n),
environment: e(s),
layout: "client",
selectedSecuritySchemeUids: e(t)?.selectedSecuritySchemeUids ?? [],
server: e(r),
title: "Authentication",
workspace: e(i)
}, null, 8, ["class", "collection", "envVariables", "environment", "selectedSecuritySchemeUids", "server", "workspace"])) : v("", !0)
])
]));
}
});
export {
N as default
};