Skip to content

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

Handle creating top-level categories

dominik-zeglene8958370b67b
diff --git a/saleor/static/dashboard-next/categories/index.tsx b/saleor/static/dashboard-next/categories/index.tsx
index 2f756993f0..e8e988088b 100644
--- a/saleor/static/dashboard-next/categories/index.tsx
+++ b/saleor/static/dashboard-next/categories/index.tsx
@@ -5,10 +5,12 @@ import { CategoryCreateView } from "./views/CategoryCreate";
import CategoryDetailsView from "./views/CategoryDetails";
import CategoryList from "./views/CategoryList";
-const CategoryDetails: React.StatelessComponent<RouteComponentProps<any>> = ({
- location,
- match
-}) => {
+interface CategoryDetailsRouteParams {
+ id: string;
+}
+const CategoryDetails: React.StatelessComponent<
+ RouteComponentProps<CategoryDetailsRouteParams>
+> = ({ location, match }) => {
const qs = parseQs(location.search.substr(1));
const params = {
after: qs.after,
@@ -21,10 +23,18 @@ const CategoryDetails: React.StatelessComponent<RouteComponentProps<any>> = ({
/>
);
};
-const CategoryCreate: React.StatelessComponent<RouteComponentProps<any>> = ({
- match
-}) => {
- return <CategoryCreateView parentId={decodeURIComponent(match.params.id)} />;
+
+interface CategoryCreateRouteParams {
+ id: string;
+}
+const CategoryCreate: React.StatelessComponent<
+ RouteComponentProps<CategoryCreateRouteParams>
+> = ({ match }) => {
+ return (
+ <CategoryCreateView
+ parentId={match.params.id ? decodeURIComponent(match.params.id) : null}
+ />
+ );
};
const Component = ({ match }) => (