Skip to content

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

Refactor href creation

dominik-zeglenda5529265bf4
diff --git a/saleor/static/dashboard-next/components/AppLayout/MenuList.tsx b/saleor/static/dashboard-next/components/AppLayout/MenuList.tsx
index 7ea9ac2f46..c240a92c20 100644
--- a/saleor/static/dashboard-next/components/AppLayout/MenuList.tsx
+++ b/saleor/static/dashboard-next/components/AppLayout/MenuList.tsx
@@ -8,12 +8,11 @@ import Typography from "@material-ui/core/Typography";
import classNames from "classnames";
import * as React from "react";
import { matchPath } from "react-router";
-import * as urlJoin from "url-join";
-import { appMountPoint } from "../..";
import { User } from "../../auth/types/User";
import { configurationMenu, configurationMenuUrl } from "../../configuration";
import i18n from "../../i18n";
+import { createHref } from "../../misc";
import { orderDraftListUrl, orderListUrl } from "../../orders/urls";
import { IMenuItem } from "./menuStructure";
@@ -162,7 +161,7 @@ const MenuList = withStyles(styles, { name: "MenuList" })(
className={classNames(classes.menuListItem, {
[classes.menuListItemActive]: isActive(menuItem)
})}
- href={urlJoin(appMountPoint, menuItem.url)}
+ href={createHref(menuItem.url)}
onClick={event => onMenuItemClick(menuItem.url, event)}
key={menuItem.label}
>
@@ -183,7 +182,7 @@ const MenuList = withStyles(styles, { name: "MenuList" })(
).length > 0 && (
<a
className={classes.menuListItem}
- href={urlJoin(appMountPoint, configurationMenuUrl)}
+ href={createHref(configurationMenuUrl)}
onClick={event => onMenuItemClick(configurationMenuUrl, event)}
>
<Typography
diff --git a/saleor/static/dashboard-next/orders/components/OrderCustomer/OrderCustomer.tsx b/saleor/static/dashboard-next/orders/components/OrderCustomer/OrderCustomer.tsx
index 37b7b006be..36067997b4 100644
--- a/saleor/static/dashboard-next/orders/components/OrderCustomer/OrderCustomer.tsx
+++ b/saleor/static/dashboard-next/orders/components/OrderCustomer/OrderCustomer.tsx
@@ -19,7 +19,7 @@ import SingleAutocompleteSelectField from "../../../components/SingleAutocomplet
import Skeleton from "../../../components/Skeleton";
import { customerUrl } from "../../../customers/urls";
import i18n from "../../../i18n";
-import { maybe } from "../../../misc";
+import { createHref, maybe } from "../../../misc";
import { OrderDetails_order } from "../../types/OrderDetails";
import { UserSearch_customers_edges_node } from "../../types/UserSearch";
@@ -137,7 +137,7 @@ const OrderCustomer = withStyles(styles, { name: "OrderCustomer" })(
<div>
<Link
underline={false}
- href={customerUrl(user.id)}
+ href={createHref(customerUrl(user.id))}
onClick={onProfileView}
>
{i18n.t("View Profile")}