@scalar/api-client
Version:
the open source API testing client
31 lines (30 loc) • 2.29 kB
JavaScript
import { deleteSecurityScheme as d, updateSelectedAuthTab as i, updateSecurityScheme as u, updateSelectedScopes as s, updateSelectedSecuritySchemes as y, addServer as c, updateServer as v, deleteServer as S, updateServerVariables as h, updateSelectedServer as n, addOperationParameter as R, updateOperationParameter as q, deleteOperationParameter as w, deleteAllOperationParameters as m, updateOperationRequestBodyContentType as O, updateOperationRequestBodyExample as f, addOperationRequestBodyFormRow as P, updateOperationRequestBodyFormRow as b, deleteOperationRequestBodyFormRow as k, updateSelectedClient as x } from "@scalar/workspace-store/mutators";
const F = ({
eventBus: a,
document: r,
isSidebarOpen: o,
sidebarState: t,
modalState: l,
workspaceStore: p
}) => {
a.on("scroll-to:nav-item", ({ id: e }) => t.handleSelectItem(e)), a.on("auth:delete:security-scheme", (e) => d(r.value, e)), a.on("auth:update:active-index", (e) => i(r.value, e)), a.on("auth:update:security-scheme", (e) => u(r.value, e)), a.on("auth:update:selected-scopes", (e) => s(r.value, e)), a.on(
"auth:update:selected-security-schemes",
async (e) => await y(r.value, e)
), a.on("server:add:server", () => c(r.value)), a.on("server:update:server", (e) => v(r.value, e)), a.on("server:delete:server", (e) => S(r.value, e)), a.on("server:update:variables", (e) => h(r.value, e)), a.on("server:update:selected", (e) => n(r.value, e)), a.on("operation:add:parameter", (e) => R(r.value, e)), a.on("operation:update:parameter", (e) => q(r.value, e)), a.on("operation:delete:parameter", (e) => w(r.value, e)), a.on("operation:delete-all:parameters", (e) => m(r.value, e)), a.on(
"operation:update:requestBody:contentType",
(e) => O(r.value, e)
), a.on("operation:update:requestBody:value", (e) => {
f(r.value, e);
}), a.on("operation:add:requestBody:formRow", (e) => {
P(r.value, e);
}), a.on(
"operation:update:requestBody:formRow",
(e) => b(r.value, e)
), a.on(
"operation:delete:requestBody:formRow",
(e) => k(r.value, e)
), a.on("ui:toggle:sidebar", () => o.value = !o.value), a.on("ui:close:client-modal", () => l.hide()), a.on("workspace:update:selected-client", (e) => x(p.workspace, e));
};
export {
F as useWorkspaceClientModalEvents
};