Fix link hrefs (#1761)

* Fix link hrefs

* Remove createHref

* Remove unused imports
This commit is contained in:
Dominik Żegleń 2022-01-17 14:08:46 +01:00 committed by GitHub
parent 41e80d71c0
commit 2aab5b80ff
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 4 additions and 10 deletions

View file

@ -2,12 +2,10 @@ import { ThemeType } from "@saleor/macaw-ui";
import moment from "moment-timezone"; import moment from "moment-timezone";
import { MutationFunction, MutationResult } from "react-apollo"; import { MutationFunction, MutationResult } from "react-apollo";
import { IntlShape } from "react-intl"; import { IntlShape } from "react-intl";
import urlJoin from "url-join";
import { ConfirmButtonTransitionState } from "./components/ConfirmButton"; import { ConfirmButtonTransitionState } from "./components/ConfirmButton";
import { StatusType } from "./components/StatusChip/types"; import { StatusType } from "./components/StatusChip/types";
import { StatusLabelProps } from "./components/StatusLabel"; import { StatusLabelProps } from "./components/StatusLabel";
import { APP_MOUNT_URI } from "./config";
import { AddressType, AddressTypeInput } from "./customers/types"; import { AddressType, AddressTypeInput } from "./customers/types";
import { import {
commonStatusMessages, commonStatusMessages,
@ -292,10 +290,6 @@ export function getUserInitials(user?: User) {
: undefined; : undefined;
} }
export function createHref(url: string) {
return urlJoin(APP_MOUNT_URI, url);
}
interface AnyEvent { interface AnyEvent {
stopPropagation: () => void; stopPropagation: () => void;
} }

View file

@ -19,7 +19,7 @@ import React from "react";
import { FormattedMessage, useIntl } from "react-intl"; import { FormattedMessage, useIntl } from "react-intl";
import { customerUrl } from "../../../customers/urls"; import { customerUrl } from "../../../customers/urls";
import { createHref, maybe } from "../../../misc"; import { maybe } from "../../../misc";
import { OrderDetails_order } from "../../types/OrderDetails"; import { OrderDetails_order } from "../../types/OrderDetails";
import { WarehouseClickAndCollectOptionEnum } from "./../../../types/globalTypes"; import { WarehouseClickAndCollectOptionEnum } from "./../../../types/globalTypes";
import messages from "./messages"; import messages from "./messages";
@ -216,7 +216,7 @@ const OrderCustomer: React.FC<OrderCustomerProps> = props => {
<div> <div>
<Link <Link
underline={false} underline={false}
href={createHref(customerUrl(user.id))} href={customerUrl(user.id)}
onClick={onProfileView} onClick={onProfileView}
> >
<FormattedMessage <FormattedMessage

View file

@ -13,7 +13,7 @@ import SingleAutocompleteSelectField, {
import { ProductErrorFragment } from "@saleor/fragments/types/ProductErrorFragment"; import { ProductErrorFragment } from "@saleor/fragments/types/ProductErrorFragment";
import { ChangeEvent } from "@saleor/hooks/useForm"; import { ChangeEvent } from "@saleor/hooks/useForm";
import { makeStyles } from "@saleor/macaw-ui"; import { makeStyles } from "@saleor/macaw-ui";
import { createHref, maybe } from "@saleor/misc"; import { maybe } from "@saleor/misc";
import { productTypeUrl } from "@saleor/productTypes/urls"; import { productTypeUrl } from "@saleor/productTypes/urls";
import { FetchMoreProps } from "@saleor/types"; import { FetchMoreProps } from "@saleor/types";
import { getFormErrors, getProductErrorMessage } from "@saleor/utils/errors"; import { getFormErrors, getProductErrorMessage } from "@saleor/utils/errors";
@ -133,7 +133,7 @@ const ProductOrganization: React.FC<ProductOrganizationProps> = props => {
<FormattedMessage defaultMessage="Product Type" /> <FormattedMessage defaultMessage="Product Type" />
</Typography> </Typography>
<Link <Link
href={createHref(productTypeUrl(productType?.id) ?? "")} href={productTypeUrl(productType?.id) ?? ""}
disabled={!productType?.id} disabled={!productType?.id}
> >
{productType?.name ?? "..."} {productType?.name ?? "..."}