Загрузка данных


dmitriev-aal@VDI-Dmitriev-A:~/Desktop/rshbintech/crft/ckof/ownfin/frontend/prd/autopayments-ui$ git diff origin/master -- src/client/view/auto-payment-edit-page/components/edit-form/index.tsx
diff --git a/src/client/view/auto-payment-edit-page/components/edit-form/index.tsx b/src/client/view/auto-payment-edit-page/components/edit-form/index.tsx
index 7a6243d..94d7f02 100644
--- a/src/client/view/auto-payment-edit-page/components/edit-form/index.tsx
+++ b/src/client/view/auto-payment-edit-page/components/edit-form/index.tsx
@@ -27,9 +27,6 @@ import {
 import { ADD_EXTRA_ACCOUNT } from "src/client/view/auto-payment-edit-page/components/edit-form/constants";
 import { setNewAdditionalAccount } from "src/client/model/get-auto-payments/slice";
 import { selectNewAdditionalAccount } from "src/client/model/get-auto-payments/selectors";
-import { useAccounts } from "src/client/entities/api/accounts-payments/get-accounts-payments-query";
-import { selectIsZustandAvailable } from "src/client/model/feature-toggles/selectors";
-import { useAutoPaymentsStore } from "src/client/view/auto-payment-edit-page/model/use-auto-payment-store";
 import styles from "../../styles.scss";
 import {
   EDIT_PAGE_SECTION_HEADING_TITLE,
@@ -64,37 +61,17 @@ export const EditForm = ({
   onScheduleClick,
 }: PaymentEditFormProps) => {
   const dispatch = useAppDispatch();
+
+  const newAdditionalAccount = useAppSelector(selectNewAdditionalAccount);
+
   const [tempSelectedAccount, setTempSelectedAccount] = useState<
     string | null | undefined
   >(null);
 
   const [isBottomSheetOpen, setBottomSheetOpen] = useState(false);
 
-  const isZustandAvailable = useAppSelector(selectIsZustandAvailable);
-
-  const zustandSetNewAdditionalAccount = useAutoPaymentsStore(
-    (state) => state.setNewAdditionalAccount
-  );
-
-  const zustandNewAdditionalAccount = useAutoPaymentsStore(
-    (state) => state.newAdditionalAccount
-  );
-
-  const { data: zustandAccounts, rawData: zustandAccountsRowData } =
-    useAccounts();
-
-  const reduxNewAdditionalAccount = useAppSelector(selectNewAdditionalAccount);
-  const reduxAccounts = useAppSelector(accountsSelector);
-  const reduxAccountsRowData = useAppSelector(selectRawAccounts);
-
-  const accounts = isZustandAvailable ? zustandAccounts : reduxAccounts;
-  const accountsRowData = isZustandAvailable
-    ? zustandAccountsRowData
-    : reduxAccountsRowData;
-
-  const newAdditionalAccount = isZustandAvailable
-    ? zustandNewAdditionalAccount
-    : reduxNewAdditionalAccount;
+  const accounts = useAppSelector(accountsSelector);
+  const accountsRowData = useAppSelector(selectRawAccounts);
 
   const filteredAccounts = useMemo(() => {
     if (!accounts || !accountsRowData?.[activeProductIndex]) {
@@ -124,12 +101,7 @@ export const EditForm = ({
   };
 
   const handleChoose = () => {
-    if (isZustandAvailable) {
-      zustandSetNewAdditionalAccount(tempSelectedAccount);
-    } else {
-      dispatch(setNewAdditionalAccount(tempSelectedAccount));
-    }
-
+    dispatch(setNewAdditionalAccount(tempSelectedAccount));
     handleClose();
   };
 
@@ -138,11 +110,7 @@ export const EditForm = ({
       const newDebitAccountId = accountsRowData?.[index]?.id;
 
       if (newDebitAccountId && newAdditionalAccount === newDebitAccountId) {
-        if (isZustandAvailable) {
-          zustandSetNewAdditionalAccount(null);
-        } else {
-          dispatch(setNewAdditionalAccount(null));
-        }
+        dispatch(setNewAdditionalAccount(null));
       }
 
       onProductChange(index);