@scalar/api-client
Version:
the open source API testing client
33 lines (32 loc) • 992 B
JavaScript
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 "./ApiClientWeb.vue.js";
/* empty css */
import { createApiClient as w } from "../../libs/create-client.js";
const C = async (p, e = {}, a = !0) => {
const t = c({
history: i(),
routes: y
}), r = w({
el: p,
appComponent: h,
configuration: e,
mountOnInitialize: a,
router: t,
layout: "web"
}), { importSpecFile: m, importSpecFromUrl: l } = r.store;
return t.afterEach((o, s) => {
e.telemetry && n?.capture("page-view", {
hostname: window.location.hostname,
to: o.path,
// capture path excluding query params
from: s.path
}), f(o);
}), e.url ? await l(e.url, "default", {
proxyUrl: e.proxyUrl
}) : e.content && await m(e.content, "default"), r;
};
export {
C as createApiClientWeb
};