@sanity/desk-tool
Version:
Tool for managing all sorts of content in a structured manner
36 lines (34 loc) • 1.07 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.router = void 0;
var _router = require("@sanity/base/router");
var _helpers = require("./helpers");
// http://localhost:3333/intent/create/template=book-by-author;type=book/eyJhdXRob3JJZCI6Imdycm0ifQ==
var router = (0, _router.route)('/', [
// "Asynchronous intent resolving" route
_router.route.intents('/intent'),
// Legacy fallback route, will be redirected to new format
(0, _router.route)('/edit/:type/:editDocumentId', [(0, _router.route)({
path: '/:params',
transform: {
params: {
toState: _helpers.legacyEditParamsToState,
toPath: _helpers.legacyEditParamsToPath
}
}
})]),
// The regular path - when the intent can be resolved to a specific pane
(0, _router.route)({
path: '/:panes',
// Legacy URLs, used to handle redirects
children: [(0, _router.route)('/:action', (0, _router.route)('/:legacyEditDocumentId'))],
transform: {
panes: {
toState: _helpers.toState,
toPath: _helpers.toPath
}
}
})]);
exports.router = router;