Skip to content

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

Fix various type errors

dominik-zeglen141432e801c7
diff --git a/saleor/static/dashboard-next/categories/views/CategoryDetails.tsx b/saleor/static/dashboard-next/categories/views/CategoryDetails.tsx
index b48ef055bc..8c6310d241 100644
--- a/saleor/static/dashboard-next/categories/views/CategoryDetails.tsx
+++ b/saleor/static/dashboard-next/categories/views/CategoryDetails.tsx
@@ -67,7 +67,7 @@ export const CategoryDetails: React.StatelessComponent<
context: "notification"
})
});
- navigate(categoryListUrl);
+ navigate(categoryListUrl());
}
};
const handleCategoryUpdate = (data: CategoryUpdate) => {
diff --git a/saleor/static/dashboard-next/collections/views/CollectionCreate.tsx b/saleor/static/dashboard-next/collections/views/CollectionCreate.tsx
index a5972e8afa..7c7fad1955 100644
--- a/saleor/static/dashboard-next/collections/views/CollectionCreate.tsx
+++ b/saleor/static/dashboard-next/collections/views/CollectionCreate.tsx
@@ -48,7 +48,7 @@ export const CollectionCreate: React.StatelessComponent<{}> = () => {
<WindowTitle title={i18n.t("Create collection")} />
<CollectionCreatePage
errors={maybe(() => data.collectionCreate.errors, [])}
- onBack={() => navigate(collectionListUrl)}
+ onBack={() => navigate(collectionListUrl())}
disabled={loading}
onSubmit={formData =>
createCollection({
diff --git a/saleor/static/dashboard-next/collections/views/CollectionDetails.tsx b/saleor/static/dashboard-next/collections/views/CollectionDetails.tsx
index 64fd9730a2..ce013140fe 100644
--- a/saleor/static/dashboard-next/collections/views/CollectionDetails.tsx
+++ b/saleor/static/dashboard-next/collections/views/CollectionDetails.tsx
@@ -125,7 +125,7 @@ export const CollectionDetails: React.StatelessComponent<
context: "notification"
})
});
- navigate(collectionListUrl);
+ navigate(collectionListUrl());
}
};
return (
diff --git a/saleor/static/dashboard-next/configuration/index.tsx b/saleor/static/dashboard-next/configuration/index.tsx
index a563334249..ec34802fb4 100644
--- a/saleor/static/dashboard-next/configuration/index.tsx
+++ b/saleor/static/dashboard-next/configuration/index.tsx
@@ -26,7 +26,7 @@ export const configurationMenu: MenuItem[] = [
icon: <ProductTypes fontSize="inherit" viewBox="0 0 44 44" />,
permission: PermissionEnum.MANAGE_PRODUCTS,
title: i18n.t("Product Types"),
- url: productTypeListUrl
+ url: productTypeListUrl()
},
{
description: i18n.t("Manage your employees and their permissions"),
diff --git a/saleor/static/dashboard-next/discounts/index.tsx b/saleor/static/dashboard-next/discounts/index.tsx
index f80d9e48e0..40d4ba0b8a 100644
--- a/saleor/static/dashboard-next/discounts/index.tsx
+++ b/saleor/static/dashboard-next/discounts/index.tsx
@@ -9,6 +9,7 @@ import { voucherDetailsPageTab } from "./components/VoucherDetailsPage";
import {
saleAddPath,
saleListPath,
+ SaleListUrlQueryParams,
salePath,
SaleUrlQueryParams,
voucherAddPath,
@@ -19,7 +20,7 @@ import {
} from "./urls";
import SaleCreateView from "./views/SaleCreate";
import SaleDetailsViewComponent from "./views/SaleDetails";
-import SaleListViewComponent, { SaleListQueryParams } from "./views/SaleList";
+import SaleListViewComponent from "./views/SaleList";
import VoucherCreateView from "./views/VoucherCreate";
import VoucherDetailsViewComponent from "./views/VoucherDetails";
import VoucherListViewComponent from "./views/VoucherList";
@@ -28,7 +29,7 @@ const SaleListView: React.StatelessComponent<RouteComponentProps<{}>> = ({
location
}) => {
const qs = parseQs(location.search.substr(1));
- const params: SaleListQueryParams = qs;
+ const params: SaleListUrlQueryParams = qs;
return <SaleListViewComponent params={params} />;
};
diff --git a/saleor/static/dashboard-next/discounts/views/SaleDetails.tsx b/saleor/static/dashboard-next/discounts/views/SaleDetails.tsx
index 51000e831a..23dab6bc61 100644
--- a/saleor/static/dashboard-next/discounts/views/SaleDetails.tsx
+++ b/saleor/static/dashboard-next/discounts/views/SaleDetails.tsx
@@ -85,7 +85,7 @@ export const SaleDetails: React.StatelessComponent<SaleDetailsProps> = ({
context: "notification"
})
});
- navigate(saleListUrl, true);
+ navigate(saleListUrl(), true);
}
};
diff --git a/saleor/static/dashboard-next/discounts/views/VoucherDetails.tsx b/saleor/static/dashboard-next/discounts/views/VoucherDetails.tsx
index e07418b1d8..551aa6a5db 100644
--- a/saleor/static/dashboard-next/discounts/views/VoucherDetails.tsx
+++ b/saleor/static/dashboard-next/discounts/views/VoucherDetails.tsx
@@ -91,7 +91,7 @@ export const VoucherDetails: React.StatelessComponent<VoucherDetailsProps> = ({
context: "notification"
})
});
- navigate(voucherListUrl, true);
+ navigate(voucherListUrl(), true);
}
};
diff --git a/saleor/static/dashboard-next/orders/index.tsx b/saleor/static/dashboard-next/orders/index.tsx
index 80b711776f..09490bb350 100644
--- a/saleor/static/dashboard-next/orders/index.tsx
+++ b/saleor/static/dashboard-next/orders/index.tsx
@@ -6,15 +6,14 @@ import { WindowTitle } from "../components/WindowTitle";
import i18n from "../i18n";
import {
orderDraftListPath,
+ OrderDraftListUrlQueryParams,
orderListPath,
OrderListUrlQueryParams,
orderPath,
OrderUrlQueryParams
} from "./urls";
import OrderDetailsComponent from "./views/OrderDetails";
-import OrderDraftListComponent, {
- OrderDraftListQueryParams
-} from "./views/OrderDraftList";
+import OrderDraftListComponent from "./views/OrderDraftList";
import OrderListComponent from "./views/OrderList";
const OrderList: React.StatelessComponent<RouteComponentProps<any>> = ({
@@ -28,7 +27,7 @@ const OrderDraftList: React.StatelessComponent<RouteComponentProps<any>> = ({
location
}) => {
const qs = parseQs(location.search.substr(1));
- const params: OrderDraftListQueryParams = qs;
+ const params: OrderDraftListUrlQueryParams = qs;
return <OrderDraftListComponent params={params} />;
};
diff --git a/saleor/static/dashboard-next/orders/misc.ts b/saleor/static/dashboard-next/orders/misc.ts
index 10ecb746c1..92a011588a 100644
--- a/saleor/static/dashboard-next/orders/misc.ts
+++ b/saleor/static/dashboard-next/orders/misc.ts
@@ -1,9 +1,11 @@
import { empty, only } from "../misc";
import { OrderStatusFilter } from "../types/globalTypes";
import { OrderListFilterTabs } from "./components/OrderListFilter";
-import { OrderListQueryParams } from "./views/OrderList";
+import { OrderListUrlQueryParams } from "./urls";
-export const getTabName = (qs: OrderListQueryParams): OrderListFilterTabs => {
+export const getTabName = (
+ qs: OrderListUrlQueryParams
+): OrderListFilterTabs => {
const filters = {
status: qs.status
};
diff --git a/saleor/static/dashboard-next/productTypes/index.tsx b/saleor/static/dashboard-next/productTypes/index.tsx
index 06500fed46..c5232cfe0e 100644
--- a/saleor/static/dashboard-next/productTypes/index.tsx
+++ b/saleor/static/dashboard-next/productTypes/index.tsx
@@ -7,6 +7,7 @@ import i18n from "../i18n";
import {
productTypeAddPath,
productTypeListPath,
+ ProductTypeListUrlQueryParams,
productTypePath,
ProductTypeUrlQueryParams
} from "./urls";
diff --git a/saleor/static/dashboard-next/productTypes/views/ProductTypeCreate.tsx b/saleor/static/dashboard-next/productTypes/views/ProductTypeCreate.tsx
index 7217e6813e..bb85f31b80 100644
--- a/saleor/static/dashboard-next/productTypes/views/ProductTypeCreate.tsx
+++ b/saleor/static/dashboard-next/productTypes/views/ProductTypeCreate.tsx
@@ -69,7 +69,7 @@ export const ProductTypeCreate: React.StatelessComponent = () => (
saveButtonBarState={
loadingCreate ? "loading" : "default"
}
- onBack={() => navigate(productTypeListUrl)}
+ onBack={() => navigate(productTypeListUrl())}
onSubmit={handleCreate}
/>
</>
diff --git a/saleor/static/dashboard-next/shipping/index.tsx b/saleor/static/dashboard-next/shipping/index.tsx
index edc6149c21..ca38149efe 100644
--- a/saleor/static/dashboard-next/shipping/index.tsx
+++ b/saleor/static/dashboard-next/shipping/index.tsx
@@ -8,19 +8,18 @@ import {
shippingZoneAddPath,
shippingZonePath,
shippingZonesListPath,
+ ShippingZonesListUrlQueryParams,
ShippingZoneUrlQueryParams
} from "./urls";
import ShippingZoneCreate from "./views/ShippingZoneCreate";
import ShippingZoneDetailsComponent from "./views/ShippingZoneDetails";
-import ShippingZonesListComponent, {
- ShippingZonesListQueryParams
-} from "./views/ShippingZonesList";
+import ShippingZonesListComponent from "./views/ShippingZonesList";
const ShippingZonesList: React.StatelessComponent<RouteComponentProps<{}>> = ({
location
}) => {
const qs = parseQs(location.search.substr(1));
- const params: ShippingZonesListQueryParams = qs;
+ const params: ShippingZonesListUrlQueryParams = qs;
return <ShippingZonesListComponent params={params} />;
};
diff --git a/saleor/static/dashboard-next/shipping/views/ShippingZoneCreate.tsx b/saleor/static/dashboard-next/shipping/views/ShippingZoneCreate.tsx
index b917ecd2be..ab1c3a0c9d 100644
--- a/saleor/static/dashboard-next/shipping/views/ShippingZoneCreate.tsx
+++ b/saleor/static/dashboard-next/shipping/views/ShippingZoneCreate.tsx
@@ -51,7 +51,7 @@ const ShippingZoneCreate: React.StatelessComponent<{}> = () => (
createShippingZoneOpts.data.shippingZoneCreate
.errors
)}
- onBack={() => navigate(shippingZonesListUrl)}
+ onBack={() => navigate(shippingZonesListUrl())}
onSubmit={formData =>
createShippingZone({
variables: {
diff --git a/saleor/static/dashboard-next/staff/mutations.ts b/saleor/static/dashboard-next/staff/mutations.ts
index 686737d08e..a0f4d154b3 100644
--- a/saleor/static/dashboard-next/staff/mutations.ts
+++ b/saleor/static/dashboard-next/staff/mutations.ts
@@ -10,6 +10,10 @@ import {
StaffMemberDelete,
StaffMemberDeleteVariables
} from "./types/StaffMemberDelete";
+import {
+ StaffMembersBulkDelete,
+ StaffMembersBulkDeleteVariables
+} from "./types/StaffMembersBulkDelete";
import {
StaffMemberUpdate,
StaffMemberUpdateVariables
diff --git a/saleor/static/dashboard-next/staff/views/StaffList.tsx b/saleor/static/dashboard-next/staff/views/StaffList.tsx
index db372d9664..a39a64953e 100644
--- a/saleor/static/dashboard-next/staff/views/StaffList.tsx
+++ b/saleor/static/dashboard-next/staff/views/StaffList.tsx
@@ -121,8 +121,7 @@ export const StaffList: React.StatelessComponent<StaffListProps> = ({
staffMembersBulkDeleteOpts.loading,
maybe(
() =>
- staffMembersBulkDeleteOpts.data.staffMembersBulkDelete
- .errors
+ staffMembersBulkDeleteOpts.data.staffBulkDelete.errors
)
);
const onSaleBulkDelete = () =>