Skip to content

Saleor Core: the high performance, composable, headless commerce API.

Split urls and paths in page views

dominik-zeglen5976184e95a7
diff --git a/saleor/static/dashboard-next/pages/index.tsx b/saleor/static/dashboard-next/pages/index.tsx
index f25c6f8019..4ef0b2e220 100644
--- a/saleor/static/dashboard-next/pages/index.tsx
+++ b/saleor/static/dashboard-next/pages/index.tsx
@@ -4,7 +4,7 @@ import { Route, RouteComponentProps, Switch } from "react-router-dom";
import { WindowTitle } from "../components/WindowTitle";
import i18n from "../i18n";
-import { pageAddUrl, pageListUrl, pageUrl } from "./urls";
+import { pageAddPath, pageListPath, pagePath } from "./urls";
import PageCreate from "./views/PageCreate";
import PageDetailsComponent from "./views/PageDetails";
import PageListComponent, { PageListQueryParams } from "./views/PageList";
@@ -29,9 +29,9 @@ const Component = () => (
<>
<WindowTitle title={i18n.t("Pages")} />
<Switch>
- <Route exact path={pageListUrl} component={PageList} />
- <Route exact path={pageAddUrl} component={PageCreate} />
- <Route exact path={pageUrl(":id")} component={PageDetails} />
+ <Route exact path={pageListPath} component={PageList} />
+ <Route exact path={pageAddPath} component={PageCreate} />
+ <Route exact path={pagePath(":id")} component={PageDetails} />
</Switch>
</>
);
diff --git a/saleor/static/dashboard-next/pages/urls.ts b/saleor/static/dashboard-next/pages/urls.ts
index 652b49681a..752217b21a 100644
--- a/saleor/static/dashboard-next/pages/urls.ts
+++ b/saleor/static/dashboard-next/pages/urls.ts
@@ -1,6 +1,12 @@
import * as urlJoin from "url-join";
const pageSectionUrl = "/pages/";
-export const pageListUrl = pageSectionUrl;
-export const pageUrl = (id: string) => urlJoin(pageSectionUrl, id);
-export const pageAddUrl = urlJoin(pageSectionUrl, "add");
+
+export const pageListPath = pageSectionUrl;
+export const pageListUrl = pageListPath;
+
+export const pagePath = (id: string) => urlJoin(pageSectionUrl, id);
+export const pageUrl = (id: string) => pagePath(encodeURIComponent(id));
+
+export const pageAddPath = urlJoin(pageSectionUrl, "add");
+export const pageAddUrl = pageAddPath;