From 9eca5a446295e0ce717fd6ca9fd4b93284170ca5 Mon Sep 17 00:00:00 2001 From: Lone Iversen <108085781+loivsen@users.noreply.github.com> Date: Thu, 5 Oct 2023 12:53:38 +0200 Subject: [PATCH] umbracopaths --- .../src/mocks/handlers/dictionary.handlers.ts | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src/Umbraco.Web.UI.Client/src/mocks/handlers/dictionary.handlers.ts b/src/Umbraco.Web.UI.Client/src/mocks/handlers/dictionary.handlers.ts index 208e7add9d..17bfb287f0 100644 --- a/src/Umbraco.Web.UI.Client/src/mocks/handlers/dictionary.handlers.ts +++ b/src/Umbraco.Web.UI.Client/src/mocks/handlers/dictionary.handlers.ts @@ -1,6 +1,6 @@ const { rest } = window.MockServiceWorker; -import { umbracoPath } from '@umbraco-cms/backoffice/utils'; import { umbDictionaryData } from '../data/dictionary.data.js'; +import { umbracoPath } from '@umbraco-cms/backoffice/utils'; import { ImportDictionaryRequestModel, DictionaryOverviewResponseModel, @@ -49,7 +49,7 @@ const overviewData: Array = [ // TODO: add schema export const handlers = [ - rest.get('/umbraco/management/api/v1/dictionary/:id', (req, res, ctx) => { + rest.get(umbracoPath('/dictionary/:id'), (req, res, ctx) => { const id = req.params.id as string; if (!id) return; @@ -57,7 +57,7 @@ export const handlers = [ return res(ctx.status(200), ctx.json(dictionary)); }), - rest.get('/umbraco/management/api/v1/dictionary', (req, res, ctx) => { + rest.get(umbracoPath('/dictionary'), (req, res, ctx) => { const skip = req.url.searchParams.get('skip'); const take = req.url.searchParams.get('take'); if (!skip || !take) return; @@ -75,7 +75,7 @@ export const handlers = [ return res(ctx.status(200), ctx.json(response)); }), - rest.post('/umbraco/management/api/v1/dictionary', async (req, res, ctx) => { + rest.post(umbracoPath('/dictionary'), async (req, res, ctx) => { const data = await req.json(); if (!data) return; @@ -94,7 +94,7 @@ export const handlers = [ return res(ctx.status(200), ctx.json(createdResult)); }), - rest.patch('/umbraco/management/api/v1/dictionary/:id', async (req, res, ctx) => { + rest.patch(umbracoPath('/dictionary/:id'), async (req, res, ctx) => { const data = await req.json(); if (!data) return; @@ -119,7 +119,7 @@ export const handlers = [ return res(ctx.status(200), ctx.json(saved)); }), - rest.get('/umbraco/management/api/v1/tree/dictionary/root', (req, res, ctx) => { + rest.get(umbracoPath('/tree/dictionary/root'), (req, res, ctx) => { const items = umbDictionaryData.getTreeRoot(); const response = { total: items.length, @@ -128,7 +128,7 @@ export const handlers = [ return res(ctx.status(200), ctx.json(response)); }), - rest.get('/umbraco/management/api/v1/tree/dictionary/children', (req, res, ctx) => { + rest.get(umbracoPath('/tree/dictionary/children'), (req, res, ctx) => { const parentId = req.url.searchParams.get('parentId'); if (!parentId) return; @@ -142,7 +142,7 @@ export const handlers = [ return res(ctx.status(200), ctx.json(response)); }), - rest.get('/umbraco/management/api/v1/tree/dictionary/item', (req, res, ctx) => { + rest.get(umbracoPath('/tree/dictionary/item'), (req, res, ctx) => { const ids = req.url.searchParams.getAll('id'); if (!ids) return; @@ -151,7 +151,7 @@ export const handlers = [ return res(ctx.status(200), ctx.json(items)); }), - rest.delete('/umbraco/management/api/v1/dictionary/:id', (req, res, ctx) => { + rest.delete(umbracoPath('/dictionary/:id'), (req, res, ctx) => { const id = req.params.id as string; if (!id) return; @@ -161,7 +161,7 @@ export const handlers = [ }), // TODO => handle properly, querystring breaks handler - rest.get('/umbraco/management/api/v1/dictionary/:id/export', (req, res, ctx) => { + rest.get(umbracoPath('/dictionary/:id/export'), (req, res, ctx) => { const id = req.params.id as string; if (!id) return; @@ -174,13 +174,13 @@ export const handlers = [ return res(ctx.status(200)); }), - rest.post('/umbraco/management/api/v1/dictionary/upload', async (req, res, ctx) => { + rest.post(umbracoPath('/dictionary/upload'), async (req, res, ctx) => { if (!req.arrayBuffer()) return; return res(ctx.status(200), ctx.json(uploadResponse)); }), - rest.post('/umbraco/management/api/v1/dictionary/import', async (req, res, ctx) => { + rest.post(umbracoPath('/dictionary/import'), async (req, res, ctx) => { const file = req.url.searchParams.get('file'); if (!file || !importResponse.id) return;