UNPKG

@scalar/api-client

Version:

the open source API testing client

36 lines (35 loc) 1.03 kB
import { createRouter as c, createWebHistory as i } from "vue-router"; import { analytics as n } from "../../analytics.js"; import { routes as y, saveActiveWorkspace as f } from "../../routes.js"; import h from "./ApiClientApp.vue.js"; /* empty css */ import { createApiClient as u } from "../../libs/create-client.js"; const U = async (p, t = {}, a = !0) => { const e = c({ history: i(), routes: y }), r = u({ el: p, appComponent: h, configuration: t, mountOnInitialize: a, router: e, layout: "desktop" }), { importSpecFile: m, importSpecFromUrl: s } = r.store; return e.afterEach((o, l) => { t.telemetry && n?.capture("page-view", { hostname: window.location.hostname, to: o.path, // capture path excluding query params from: l.path }), f(o); }), t.url ? await s(t.url, "default", { proxyUrl: t.proxyUrl }) : t.content && await m(t.content, "default"), { client: r, router: e }; }; export { U as createApiClientApp };