@scalar/api-client
Version:
the open source API testing client
120 lines (119 loc) • 3.48 kB
JavaScript
import { mergeSearchParams as i } from "@scalar/helpers/url/merge-urls";
import s from "../../collection/components/Authentication.vue.js";
import o from "../../collection/components/Cookies.vue.js";
import n from "../../collection/components/Environment.vue.js";
import h from "../../collection/components/Overview.vue.js";
import d from "../../collection/components/Servers.vue.js";
import m from "../../collection/components/Settings.vue.js";
import u from "../../collection/DocumentCollection.vue.js";
import f from "../../collection/WorkspaceCollection.vue.js";
import l from "../../operation/Operation.vue.js";
import { workspaceStorage as a } from "../../../helpers/storage.js";
const A = [
{
path: "/@:namespace/:workspaceSlug",
children: [
{
path: "document/:documentSlug",
children: [
// Example page
{
name: "example",
path: "path/:pathEncoded/method/:method/example/:exampleName",
component: l
},
// Document Page
{
name: "document",
path: "",
component: u,
children: [
// Redirect to overview
{
name: "document.redirect",
path: "",
redirect: {
name: "document.overview"
}
},
// Document overview
{
name: "document.overview",
path: "overview",
component: h
},
// Document servers
{
name: "document.servers",
path: "servers",
component: d
},
// Document environment
{
name: "document.environment",
path: "environment",
component: n
},
// Document authentication
{
name: "document.authentication",
path: "authentication",
component: s
},
// Document cookies
{
name: "document.cookies",
path: "cookies",
component: o
},
// Document settings
{
name: "document.settings",
path: "settings",
component: m
}
]
}
]
},
// Workspace page
{
name: "workspace",
path: "",
component: f,
children: [
// Workspace environment
{
name: "workspace.environment",
path: "environment",
component: n
},
// Workspace cookies
{
name: "workspace.cookies",
path: "cookies",
component: o
},
// Workspace settings
{
name: "workspace.settings",
path: "settings",
component: m
}
]
}
]
},
{
path: "/:pathMatch(.*)*",
redirect: () => {
const e = "/@local/default/document/drafts/overview", r = a.getLastPath() ?? e;
a.setCurrentPath(e);
const t = new URL(r, "http://example.com"), c = new URLSearchParams(window.location.search), p = i(t.searchParams, c);
return `${t.pathname}?${p.toString()}`;
}
}
];
export {
A as ROUTES
};