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