Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
Split paths and urls in staff views
dominik-zeglend5e0bfd3d7a1
diff --git a/saleor/static/dashboard-next/staff/index.tsx b/saleor/static/dashboard-next/staff/index.tsxindex f657ec4f8d..1d9458205f 100644--- a/saleor/static/dashboard-next/staff/index.tsx+++ b/saleor/static/dashboard-next/staff/index.tsx@@ -4,7 +4,11 @@ import { Route, RouteComponentProps, Switch } from "react-router-dom";import { WindowTitle } from "../components/WindowTitle";import i18n from "../i18n";-import { staffListUrl, staffMemberAddUrl, staffMemberDetailsUrl } from "./urls";+import {+ staffListPath,+ staffMemberAddPath,+ staffMemberDetailsPath+} from "./urls";import StaffDetailsComponent from "./views/StaffDetails";import StaffListComponent, { StaffListQueryParams } from "./views/StaffList";@@ -32,9 +36,9 @@ const Component = () => (<><WindowTitle title={i18n.t("Staff")} /><Switch>- <Route exact path={staffListUrl} component={StaffList} />- <Route exact path={staffMemberAddUrl} component={StaffList} />- <Route path={staffMemberDetailsUrl(":id")} component={StaffDetails} />+ <Route exact path={staffListPath} component={StaffList} />+ <Route exact path={staffMemberAddPath} component={StaffList} />+ <Route path={staffMemberDetailsPath(":id")} component={StaffDetails} /></Switch></>);diff --git a/saleor/static/dashboard-next/staff/urls.ts b/saleor/static/dashboard-next/staff/urls.tsindex 9c39e968e6..a682aa472a 100644--- a/saleor/static/dashboard-next/staff/urls.ts+++ b/saleor/static/dashboard-next/staff/urls.ts@@ -1,8 +1,18 @@import * as urlJoin from "url-join";const staffSection = "/staff/";-export const staffListUrl = staffSection;-export const staffMemberAddUrl = urlJoin(staffSection, "add");-export const staffMemberDetailsUrl = (id: string) => urlJoin(staffSection, id);++export const staffListPath = staffSection;+export const staffListUrl = staffListPath;++export const staffMemberAddPath = urlJoin(staffSection, "add");+export const staffMemberAddUrl = staffMemberAddPath;++export const staffMemberDetailsPath = (id: string) => urlJoin(staffSection, id);+export const staffMemberDetailsUrl = (id: string) =>+ staffMemberDetailsPath(encodeURIComponent(id));++export const staffMemberRemovePath = (id: string) =>+ urlJoin(staffMemberDetailsPath(id), "remove");export const staffMemberRemoveUrl = (id: string) =>- urlJoin(staffMemberDetailsUrl(id), "remove");+ staffMemberRemovePath(encodeURIComponent(id));diff --git a/saleor/static/dashboard-next/staff/views/StaffDetails.tsx b/saleor/static/dashboard-next/staff/views/StaffDetails.tsxindex ef2ffeee52..cef2f22219 100644--- a/saleor/static/dashboard-next/staff/views/StaffDetails.tsx+++ b/saleor/static/dashboard-next/staff/views/StaffDetails.tsx@@ -19,6 +19,7 @@ import { StaffMemberUpdate } from "../types/StaffMemberUpdate";import {staffListUrl,staffMemberDetailsUrl,+ staffMemberRemovePath,staffMemberRemoveUrl} from "../urls";@@ -90,7 +91,7 @@ export const StaffDetails: React.StatelessComponent<OrderListProps> = ({saveButtonBarState={formTransitionState}/><Route- path={staffMemberRemoveUrl(id)}+ path={staffMemberRemovePath(":id")}render={({ match }) => (<ActionDialogopen={!!match}diff --git a/saleor/static/dashboard-next/staff/views/StaffList.tsx b/saleor/static/dashboard-next/staff/views/StaffList.tsxindex 3727c99eba..ff7ab1e770 100644--- a/saleor/static/dashboard-next/staff/views/StaffList.tsx+++ b/saleor/static/dashboard-next/staff/views/StaffList.tsx@@ -15,6 +15,7 @@ import { TypedStaffListQuery } from "../queries";import { StaffMemberAdd } from "../types/StaffMemberAdd";import {staffListUrl,+ staffMemberAddPath,staffMemberAddUrl,staffMemberDetailsUrl} from "../urls";@@ -46,11 +47,7 @@ export const StaffList: React.StatelessComponent<StaffListProps> = ({pushMessage({text: i18n.t("Succesfully added staff member")});- navigate(- staffMemberDetailsUrl(- encodeURIComponent(data.staffCreate.user.id)- )- );+ navigate(staffMemberDetailsUrl(data.staffCreate.user.id));}};return (@@ -90,14 +87,10 @@ export const StaffList: React.StatelessComponent<StaffListProps> = ({onNextPage={loadNextPage}onPreviousPage={loadPreviousPage}onRowClick={id => () =>- navigate(- staffMemberDetailsUrl(- encodeURIComponent(id)- )- )}+ navigate(staffMemberDetailsUrl(id))}/><Route- path={staffMemberAddUrl}+ path={staffMemberAddPath}render={({ match }) => (<StaffAddMemberDialogerrors={maybe(