From bd7fe9b9fad44951cbed0285cae104f451cd52af Mon Sep 17 00:00:00 2001 From: Jacob Overgaard <752371+iOvergaard@users.noreply.github.com> Date: Fri, 7 Jul 2023 14:06:50 +0200 Subject: [PATCH] move order of handlers this way the wildcard :id does not catch the other more specific ones first --- .../src/mocks/handlers/document.handlers.ts | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/Umbraco.Web.UI.Client/src/mocks/handlers/document.handlers.ts b/src/Umbraco.Web.UI.Client/src/mocks/handlers/document.handlers.ts index 65462102b7..44be7dcb89 100644 --- a/src/Umbraco.Web.UI.Client/src/mocks/handlers/document.handlers.ts +++ b/src/Umbraco.Web.UI.Client/src/mocks/handlers/document.handlers.ts @@ -53,13 +53,10 @@ export const handlers = [ return res(ctx.status(200), ctx.json(saved)); }), - rest.get(umbracoPath('/document/:id'), (req, res, ctx) => { - const id = req.params.id as string; - if (!id) return; + rest.get(umbracoPath('/document/root/allowed-document-types'), (req, res, ctx) => { + const response = umbDocumentData.getAllowedDocumentTypesAtRoot(); - const document = umbDocumentData.getById(id); - - return res(ctx.status(200), ctx.json(document)); + return res(ctx.status(200), ctx.json(response)); }), rest.get(umbracoPath('/document/:id/allowed-document-types'), (req, res, ctx) => { @@ -71,9 +68,12 @@ export const handlers = [ return res(ctx.status(200), ctx.json(response)); }), - rest.get(umbracoPath('/document/root/allowed-document-types'), (req, res, ctx) => { - const response = umbDocumentData.getAllowedDocumentTypesAtRoot(); + rest.get(umbracoPath('/document/:id'), (req, res, ctx) => { + const id = req.params.id as string; + if (!id) return; - return res(ctx.status(200), ctx.json(response)); + const document = umbDocumentData.getById(id); + + return res(ctx.status(200), ctx.json(document)); }), ];