Skip to content

The complete open source platform to run your entire marketplace. Storefront, vendor panel, admin console, and integrations in one enterprise-grade platform you own.

fix(vendor): fix promotion rule value options 400 error and refactor edit rules

vholik622f9109d5eb
diff --git a/packages/vendor/src/hooks/api/promotions.tsx b/packages/vendor/src/hooks/api/promotions.tsx
index c0e302663..79166cf40 100644
--- a/packages/vendor/src/hooks/api/promotions.tsx
+++ b/packages/vendor/src/hooks/api/promotions.tsx
@@ -24,12 +24,12 @@ export const promotionsQueryKeys = {
listRules: (
id: string | null,
ruleType: string,
- query?: Record<string, unknown>
+ query?: Record<string, unknown>,
) => [PROMOTIONS_QUERY_KEY, id, ruleType, query],
listRuleAttributes: (
ruleType: string,
promotionType?: string,
- applicationMethodTargetType?: string
+ applicationMethodTargetType?: string,
) => [
PROMOTIONS_QUERY_KEY,
ruleType,
@@ -39,7 +39,7 @@ export const promotionsQueryKeys = {
listRuleValues: (
ruleType: string,
ruleValue: string,
- query?: Record<string, unknown>
+ query?: Record<string, unknown>,
) => [PROMOTIONS_QUERY_KEY, ruleType, ruleValue, query],
};
@@ -49,7 +49,7 @@ export const usePromotion = (
unknown,
ClientError,
InferClientOutput<typeof sdk.vendor.promotions.$id.query>
- >
+ >,
) => {
const { data, ...rest } = useQuery({
queryKey: promotionsQueryKeys.detail(id),
@@ -71,7 +71,7 @@ export const usePromotionRules = (
unknown,
ClientError,
InferClientOutput<typeof sdk.vendor.promotions.$id.$ruleType.query>
- >
+ >,
) => {
const { data, ...rest } = useQuery({
queryKey: promotionsQueryKeys.listRules(id, ruleType, query),
@@ -93,7 +93,7 @@ export const usePromotions = (
unknown,
ClientError,
InferClientOutput<typeof sdk.vendor.promotions.query>
- >
+ >,
) => {
const { data, ...rest } = useQuery({
queryKey: promotionsQueryKeys.list(query),
@@ -114,13 +114,13 @@ export const usePromotionRuleAttributes = (
InferClientOutput<
typeof sdk.vendor.promotions.ruleAttributeOptions.$ruleType.query
>
- >
+ >,
) => {
const { data, ...rest } = useQuery({
queryKey: promotionsQueryKeys.listRuleAttributes(
ruleType,
promotionType,
- applicationMethodTargetType
+ applicationMethodTargetType,
),
queryFn: async () =>
sdk.vendor.promotions.ruleAttributeOptions.$ruleType.query({
@@ -150,19 +150,17 @@ export const usePromotionRuleValues = (
InferClientOutput<
typeof sdk.vendor.promotions.ruleValueOptions.$ruleType.$ruleAttributeId.query
>
- >
+ >,
) => {
const { data, ...rest } = useQuery({
- queryKey: promotionsQueryKeys.listRuleValues(
- ruleType,
- ruleValue,
- query || {}
- ),
+ queryKey: promotionsQueryKeys.listRuleValues(ruleType, ruleValue, query),
queryFn: async () =>
sdk.vendor.promotions.ruleValueOptions.$ruleType.$ruleAttributeId.query({
+ ...query,
$ruleType: ruleType,
$ruleAttributeId: ruleValue,
- ...query,
+ limit: query?.limit ?? 100,
+ offset: query?.offset ?? 0,
}),
...options,
});
@@ -176,7 +174,7 @@ export const useDeletePromotion = (
InferClientOutput<typeof sdk.vendor.promotions.$id.delete>,
ClientError,
void
- >
+ >,
) => {
return useMutation({
mutationFn: () => sdk.vendor.promotions.$id.delete({ $id: id }),
@@ -197,7 +195,7 @@ export const useCreatePromotion = (
InferClientOutput<typeof sdk.vendor.promotions.mutate>,
ClientError,
InferClientInput<typeof sdk.vendor.promotions.mutate>
- >
+ >,
) => {
return useMutation({
mutationFn: (payload) => sdk.vendor.promotions.mutate(payload),
@@ -216,7 +214,7 @@ export const useUpdatePromotion = (
InferClientOutput<typeof sdk.vendor.promotions.$id.mutate>,
ClientError,
Omit<InferClientInput<typeof sdk.vendor.promotions.$id.mutate>, "$id">
- >
+ >,
) => {
return useMutation({
mutationFn: (payload) =>
@@ -240,7 +238,7 @@ export const usePromotionAddRules = (
InferClientInput<typeof sdk.vendor.promotions.$id.rules.batch.mutate>,
"$id"
>
- >
+ >,
) => {
return useMutation({
mutationFn: (payload) => {
@@ -256,7 +254,10 @@ export const usePromotionAddRules = (
...payload,
});
}
- return sdk.vendor.promotions.$id.rules.batch.mutate({ $id: id, ...payload });
+ return sdk.vendor.promotions.$id.rules.batch.mutate({
+ $id: id,
+ ...payload,
+ });
},
onSuccess: (data, variables, context) => {
queryClient.invalidateQueries({ queryKey: promotionsQueryKeys.all });
@@ -277,7 +278,7 @@ export const usePromotionRemoveRules = (
InferClientInput<typeof sdk.vendor.promotions.$id.rules.batch.mutate>,
"$id"
>
- >
+ >,
) => {
return useMutation({
mutationFn: (payload) => {
@@ -293,7 +294,10 @@ export const usePromotionRemoveRules = (
...payload,
});
}
- return sdk.vendor.promotions.$id.rules.batch.mutate({ $id: id, ...payload });
+ return sdk.vendor.promotions.$id.rules.batch.mutate({
+ $id: id,
+ ...payload,
+ });
},
onSuccess: (data, variables, context) => {
queryClient.invalidateQueries({ queryKey: promotionsQueryKeys.all });
@@ -314,7 +318,7 @@ export const usePromotionUpdateRules = (
InferClientInput<typeof sdk.vendor.promotions.$id.rules.batch.mutate>,
"$id"
>
- >
+ >,
) => {
return useMutation({
mutationFn: (payload) => {
@@ -330,7 +334,10 @@ export const usePromotionUpdateRules = (
...payload,
});
}
- return sdk.vendor.promotions.$id.rules.batch.mutate({ $id: id, ...payload });
+ return sdk.vendor.promotions.$id.rules.batch.mutate({
+ $id: id,
+ ...payload,
+ });
},
onSuccess: (data, variables, context) => {
queryClient.invalidateQueries({ queryKey: promotionsQueryKeys.all });
@@ -343,7 +350,7 @@ export const usePromotionUpdateRules = (
export const useRemovePromotionFromCampaign = (
promotionId: string,
- options?: UseMutationOptions<any, Error, void>
+ options?: UseMutationOptions<any, Error, void>,
) => {
return useMutation({
mutationFn: () =>
diff --git a/packages/vendor/src/pages/promotions/common/edit-rules/components/edit-rules-wrapper/edit-rules-wrapper.tsx b/packages/vendor/src/pages/promotions/common/edit-rules/components/edit-rules-wrapper/edit-rules-wrapper.tsx
index 5f5ee1e52..96056481f 100644
--- a/packages/vendor/src/pages/promotions/common/edit-rules/components/edit-rules-wrapper/edit-rules-wrapper.tsx
+++ b/packages/vendor/src/pages/promotions/common/edit-rules/components/edit-rules-wrapper/edit-rules-wrapper.tsx
@@ -1,148 +1,115 @@
import {
CreatePromotionRuleDTO,
- HttpTypes,
+ PromotionDTO,
PromotionRuleDTO,
-} from "@medusajs/types"
-import { useRouteModal } from "@components/modals"
+ PromotionRuleOperatorValues,
+ PromotionRuleResponse,
+} from "@medusajs/types";
+import { useRouteModal } from "../../../../../../components/modals";
import {
usePromotionAddRules,
usePromotionRemoveRules,
usePromotionUpdateRules,
useUpdatePromotion,
-} from "@hooks/api/promotions"
-import { RuleTypeValues } from "../../edit-rules"
-import { EditRulesForm } from "../edit-rules-form"
-import { EditRulesType } from "../edit-rules-form/form-schema"
+} from "../../../../../../hooks/api/promotions";
+import { RuleTypeValues } from "../../edit-rules";
+import { EditRulesForm } from "../edit-rules-form";
+import { getRuleValue } from "./utils";
type EditPromotionFormProps = {
- promotion: HttpTypes.AdminPromotion
- rules: PromotionRuleDTO[]
- ruleType: RuleTypeValues
-}
+ promotion: PromotionDTO;
+ rules: PromotionRuleDTO[];
+ ruleType: RuleTypeValues;
+};
export const EditRulesWrapper = ({
promotion,
rules,
ruleType,
}: EditPromotionFormProps) => {
- const { handleSuccess } = useRouteModal()
- const { mutateAsync: updatePromotion } = useUpdatePromotion(promotion.id)
+ const { handleSuccess } = useRouteModal();
+ const { mutateAsync: updatePromotion } = useUpdatePromotion(promotion.id);
const { mutateAsync: addPromotionRules } = usePromotionAddRules(
promotion.id,
- ruleType
- )
+ ruleType,
+ );
const { mutateAsync: removePromotionRules } = usePromotionRemoveRules(
promotion.id,
- ruleType
- )
+ ruleType,
+ );
const { mutateAsync: updatePromotionRules, isPending } =
- usePromotionUpdateRules(promotion.id, ruleType)
+ usePromotionUpdateRules(promotion.id, ruleType);
const handleSubmit = (
- rulesToRemove?: { id: string; disguised?: boolean; attribute: string }[]
+ rulesToRemove?: { id: string; disguised: boolean; attribute: string }[],
) => {
- return async function (data: EditRulesType) {
- const applicationMethodData: Record<string, string | number | null> = {}
- const { rules: allRules = [] } = data
- const disguisedRules = allRules.filter((rule) => rule.disguised)
+ return async function (data: { rules: PromotionRuleResponse[] }) {
+ const applicationMethodData: Record<any, any> = {};
+ const { rules: allRules = [] } = data;
+ const disguisedRules = allRules.filter((rule) => rule.disguised);
const disguisedRulesToRemove =
- rulesToRemove?.filter((r) => r.disguised) || []
+ rulesToRemove?.filter((r) => r.disguised) || [];
+ // For all the rules that were disguised, convert them to actual values in the
+ // database, they are currently all under application_method. If more of these are coming
+ // up, abstract this away.
for (const rule of disguisedRules) {
- const value = Array.isArray(rule.values)
- ? rule.values[0] || null
- : rule.values || null
-
- applicationMethodData[rule.attribute!] =
- rule.field_type === "number" && value ? Number(value) : value
+ applicationMethodData[rule.attribute] = getRuleValue(rule);
}
for (const rule of disguisedRulesToRemove) {
- applicationMethodData[rule.attribute] = null
+ applicationMethodData[rule.attribute] = null;
}
- const rulesData = allRules.filter((rule) => !rule.disguised)
-
- const rulesToCreate: CreatePromotionRuleDTO[] = []
- const rulesToUpdate: EditRulesType["rules"] = []
-
- for (const rule of rulesData) {
- if ("id" in rule && typeof rule.id === "string") {
- rulesToUpdate.push(rule)
- } else {
- const createRule: CreatePromotionRuleDTO = {
- attribute: rule.attribute!,
- operator: rule.operator,
- values: rule.values,
- }
- rulesToCreate.push(createRule)
- }
- }
+ // This variable will contain the rules that are actual rule objects, without the disguised
+ // objects
+ const rulesData = allRules.filter((rule) => !rule.disguised);
+ const rulesToCreate: CreatePromotionRuleDTO[] = rulesData.filter(
+ (rule) => !("id" in rule),
+ );
+ const rulesToUpdate = rulesData.filter(
+ (rule: { id: string }) => typeof rule.id === "string",
+ );
if (Object.keys(applicationMethodData).length) {
await updatePromotion({
application_method: applicationMethodData,
- })
- }
-
- if (rulesToCreate.length > 0) {
- const rulesToUpdateIds = rulesToUpdate
- .map((r) => r.id)
- .filter((id): id is string => Boolean(id))
- if (rulesToUpdateIds.length > 0) {
- await removePromotionRules({
- rules: rulesToUpdateIds,
- })
- }
-
- if (rulesToRemove?.length) {
- const removeIds = rulesToRemove
- .map((r) => r.id)
- .filter((id): id is string => Boolean(id))
- await removePromotionRules({
- rules: removeIds,
- })
- }
-
- const allRulesToAdd = [
- ...rulesToCreate,
- ...rulesToUpdate.map((rule) => ({
- attribute: rule.attribute!,
- operator: rule.operator,
- values: rule.values,
- })),
- ]
- await addPromotionRules({
- rules: allRulesToAdd,
- })
- } else {
- if (rulesToRemove?.length) {
- const removeIds = rulesToRemove
- .map((r) => r.id)
- .filter((id): id is string => Boolean(id))
- await removePromotionRules({
- rules: removeIds,
- })
- }
-
- if (rulesToUpdate.length) {
- const updateRules = rulesToUpdate.map((rule) => ({
- id: rule.id!,
- attribute: rule.attribute,
- operator: rule.operator,
- values: rule.values,
- }))
- await updatePromotionRules({
- rules: updateRules,
- })
- }
+ } as any);
}
- handleSuccess()
- }
- }
+ rulesToCreate.length &&
+ (await addPromotionRules({
+ rules: rulesToCreate.map((rule) => {
+ return {
+ attribute: rule.attribute,
+ operator: rule.operator,
+ values: rule.values,
+ } as any;
+ }),
+ }));
+
+ rulesToRemove?.length &&
+ (await removePromotionRules({
+ rule_ids: rulesToRemove.map((r) => r.id).filter(Boolean),
+ }));
+
+ rulesToUpdate.length &&
+ (await updatePromotionRules({
+ rules: rulesToUpdate.map((rule: PromotionRuleResponse) => {
+ return {
+ id: rule.id!,
+ attribute: rule.attribute,
+ operator: rule.operator as PromotionRuleOperatorValues,
+ values: rule.values as unknown as string | string[],
+ };
+ }),
+ }));
+
+ handleSuccess();
+ };
+ };
return (
<EditRulesForm
@@ -152,5 +119,5 @@ export const EditRulesWrapper = ({
handleSubmit={handleSubmit}
isSubmitting={isPending}
/>
- )
-}
+ );
+};
diff --git a/packages/vendor/src/pages/promotions/common/edit-rules/components/rule-value-form-field/rule-value-form-field.tsx b/packages/vendor/src/pages/promotions/common/edit-rules/components/rule-value-form-field/rule-value-form-field.tsx
index dc63bc276..8a38d34fd 100644
--- a/packages/vendor/src/pages/promotions/common/edit-rules/components/rule-value-form-field/rule-value-form-field.tsx
+++ b/packages/vendor/src/pages/promotions/common/edit-rules/components/rule-value-form-field/rule-value-form-field.tsx
@@ -1,22 +1,32 @@
-import { HttpTypes } from '@medusajs/types';
-import { Input, Select } from '@medusajs/ui';
-import { useWatch } from 'react-hook-form';
-
-import { Form } from '../../../../../../components/common/form';
-import { Combobox } from '../../../../../../components/inputs/combobox';
-import { usePromotionRuleValues } from '../../../../../../hooks/api/promotions';
-import { useStore } from '../../../../../../hooks/api/store';
-import { useEffect } from 'react';
+import {
+ ApplicationMethodTargetTypeValues,
+ HttpTypes,
+ RuleTypeValues,
+} from "@medusajs/types";
+import { Input } from "@medusajs/ui";
+import { useWatch } from "react-hook-form";
+import { useTranslation } from "react-i18next";
+import { useEffect } from "react";
+
+import { Form } from "../../../../../../components/common/form";
+import { Combobox } from "../../../../../../components/inputs/combobox";
+import { useStore } from "../../../../../../hooks/api";
+import { useComboboxData } from "../../../../../../hooks/use-combobox-data";
+import { sdk } from "../../../../../../lib/client";
type RuleValueFormFieldType = {
form: any;
identifier: string;
- scope: 'application_method.buy_rules' | 'rules' | 'application_method.target_rules';
+ scope:
+ | "application_method.buy_rules"
+ | "rules"
+ | "application_method.target_rules";
name: string;
operator: string;
fieldRule: any;
attributes: HttpTypes.AdminRuleAttributeOption[];
- ruleType: 'rules' | 'target-rules' | 'buy-rules';
+ ruleType: RuleTypeValues;
+ applicationMethodTargetType: ApplicationMethodTargetTypeValues | undefined;
};
const buildFilters = (attribute?: string, store?: HttpTypes.AdminStore) => {
@@ -24,9 +34,9 @@ const buildFilters = (attribute?: string, store?: HttpTypes.AdminStore) => {
return {};
}
- if (attribute === 'currency_code') {
+ if (attribute === "currency_code") {
return {
- value: store.supported_currencies?.map(c => c.currency_code)
+ value: store.supported_currencies?.map((c) => c.currency_code),
};
}
@@ -41,30 +51,51 @@ export const RuleValueFormField = ({
operator,
fieldRule,
attributes,
- ruleType
+ ruleType,
+ applicationMethodTargetType,
}: RuleValueFormFieldType) => {
- const attribute = attributes?.find(attr => attr.value === fieldRule.attribute);
+ const { t } = useTranslation();
- const { store, isLoading: isStoreLoading } = useStore();
+ const attribute = attributes?.find(
+ (attr) => attr.value === fieldRule.attribute,
+ );
- const promotionType = useWatch({
- control: form.control,
- name: 'type'
- });
+ const { store, isLoading: isStoreLoading } = useStore();
- const applicationMethodType = useWatch({
- control: form.control,
- name: 'application_method.type'
+ const comboboxData = useComboboxData({
+ queryFn: async (params) => {
+ return await sdk.vendor.promotions.ruleValueOptions.$ruleType.$ruleAttributeId.query(
+ {
+ limit: params?.limit ?? 100,
+ offset: params?.offset ?? 0,
+ $ruleType: ruleType,
+ $ruleAttributeId: attribute?.id!,
+ ...params,
+ ...buildFilters(attribute?.id, store!),
+ application_method_target_type:
+ applicationMethodTargetType as ApplicationMethodTargetTypeValues,
+ },
+ );
+ },
+ enabled:
+ !!attribute?.id &&
+ ["select", "multiselect"].includes(attribute.field_type) &&
+ !isStoreLoading,
+ getOptions: (data) => data.values,
+ queryKey: ["rule-value-options", ruleType, attribute?.id],
});
const watchOperator = useWatch({
control: form.control,
- name: operator
+ name: operator,
});
useEffect(() => {
const hasDirtyRules = Object.keys(form.formState.dirtyFields).length > 0;
+ /**
+ * Don't reset values if fileds didn't change - this is to prevent reset of form on initial render when editing an existing rule
+ */
if (!hasDirtyRules) {
return;
}
@@ -76,28 +107,12 @@ export const RuleValueFormField = ({
}
}, [watchOperator]);
- const { values: options = [] } = usePromotionRuleValues(
- ruleType,
- attribute?.id!,
- {
- ...buildFilters(attribute?.id, store),
- promotion_type: promotionType,
- application_method_type: applicationMethodType
- },
- {
- enabled:
- !!attribute?.id &&
- ['select', 'multiselect'].includes(attribute.field_type) &&
- !isStoreLoading
- }
- );
-
return (
<Form.Field
key={`${identifier}.${scope}.${name}-${fieldRule.attribute}`}
name={name}
render={({ field: { onChange, ref, ...field } }) => {
- if (attribute?.field_type === 'number') {
+ if (attribute?.field_type === "number") {
return (
<Form.Item className="basis-1/2">
<Form.Control>
@@ -114,7 +129,7 @@ export const RuleValueFormField = ({
<Form.ErrorMessage />
</Form.Item>
);
- } else if (attribute?.field_type === 'text') {
+ } else if (attribute?.field_type === "text") {
return (
<Form.Item className="basis-1/2">
<Form.Control>
@@ -129,53 +144,23 @@ export const RuleValueFormField = ({
<Form.ErrorMessage />
</Form.Item>
);
- } else if (watchOperator === 'eq') {
- return (
- <Form.Item className="basis-1/2">
- <Form.Control>
- <Select
- {...field}
- value={Array.isArray(field.value) ? field.value[0] : field.value}
- onValueChange={onChange}
- disabled={!fieldRule.attribute}
- >
- <Select.Trigger
- ref={ref}
- className="bg-ui-bg-base"
- >
- <Select.Value placeholder="Select Value" />
- </Select.Trigger>
-
- <Select.Content>
- {options?.map((option, i) => (
- <Select.Item
- key={`${identifier}-value-option-${i}`}
- value={option.value}
- >
- <span className="text-ui-fg-subtle">{option.label}</span>
- </Select.Item>
- ))}
- </Select.Content>
- </Select>
- </Form.Control>
- <Form.ErrorMessage />
- </Form.Item>
- );
} else {
return (
<Form.Item className="basis-1/2">
<Form.Control>
<Combobox
{...field}
+ {...comboboxData}
ref={ref}
- placeholder="Select Values"
- options={options}
+ placeholder={
+ watchOperator === "eq"
+ ? t("labels.selectValue")
+ : t("labels.selectValues")
+ }
+ disabled={!watchOperator}
onChange={onChange}
- className="bg-ui-bg-base"
- disabled={!fieldRule.attribute}
/>
</Form.Control>
-
<Form.ErrorMessage />
</Form.Item>
);
diff --git a/packages/vendor/src/pages/promotions/common/edit-rules/edit-rules.tsx b/packages/vendor/src/pages/promotions/common/edit-rules/edit-rules.tsx
index 722f2a878..360e5f968 100644
--- a/packages/vendor/src/pages/promotions/common/edit-rules/edit-rules.tsx
+++ b/packages/vendor/src/pages/promotions/common/edit-rules/edit-rules.tsx
@@ -1,48 +1,48 @@
-import { PromotionRuleDTO } from "@medusajs/types"
-import { Heading } from "@medusajs/ui"
-import { useTranslation } from "react-i18next"
-import { useParams } from "react-router-dom"
-import { RouteDrawer } from "@components/modals"
-import { usePromotion } from "@hooks/api/promotions"
-import { EditRulesWrapper } from "./components/edit-rules-wrapper"
+import { PromotionRuleDTO } from "@medusajs/types";
+import { Heading } from "@medusajs/ui";
+import { useTranslation } from "react-i18next";
+import { useParams } from "react-router-dom";
+import { RouteDrawer } from "@components/modals";
+import { usePromotion } from "@hooks/api/promotions";
+import { EditRulesWrapper } from "./components/edit-rules-wrapper";
export enum RuleType {
RULES = "rules",
BUY_RULES = "buy-rules",
TARGET_RULES = "target-rules",
}
-export type RuleTypeValues = "rules" | "buy-rules" | "target-rules"
+export type RuleTypeValues = "rules" | "buy-rules" | "target-rules";
export const EditRules = () => {
- const params = useParams()
+ const params = useParams();
const allowedParams: string[] = [
RuleType.RULES,
RuleType.BUY_RULES,
RuleType.TARGET_RULES,
- ]
+ ];
if (!allowedParams.includes(params.ruleType!)) {
- throw "invalid page"
+ throw "invalid page";
}
- const { t } = useTranslation()
- const ruleType = params.ruleType as RuleTypeValues
- const id = params.id as string
- const rules: PromotionRuleDTO[] = []
- const { promotion, isPending: isLoading, isError, error } = usePromotion(id)
+ const { t } = useTranslation();
+ const ruleType = params.ruleType as RuleTypeValues;
+ const id = params.id as string;
+ const rules: PromotionRuleDTO[] = [];
+ const { promotion, isPending: isLoading, isError, error } = usePromotion(id);
if (promotion) {
if (ruleType === RuleType.RULES) {
- rules.push(...(promotion.rules || []))
+ rules.push(...(promotion.rules || []));
} else if (ruleType === RuleType.TARGET_RULES) {
- rules.push(...(promotion?.application_method?.target_rules || []))
+ rules.push(...(promotion?.application_method?.target_rules || []));
} else if (ruleType === RuleType.BUY_RULES) {
- rules.push(...(promotion.application_method?.buy_rules || []))
+ rules.push(...(promotion.application_method?.buy_rules || []));
}
}
if (isError) {
- throw error
+ throw error;
}
return (
@@ -50,7 +50,6 @@ export const EditRules = () => {
<RouteDrawer.Header>
<Heading>{t(`promotions.edit.${ruleType}.title`)}</Heading>
</RouteDrawer.Header>
-
{!isLoading && promotion && (
<EditRulesWrapper
promotion={promotion}
@@ -59,5 +58,5 @@ export const EditRules = () => {
/>
)}
</RouteDrawer>
- )
-}
+ );
+};