refactor: simplify frontend state and mutation boundaries
Frontend verify / commits (pull_request) Successful in 31s
Frontend verify / security (pull_request) Successful in 11s
Frontend verify / verify (pull_request) Successful in 9m1s
Frontend verify / commits (push) Skipped
Frontend verify / security (push) Successful in 10s
Frontend verify / verify (push) Successful in 9m59s

This commit was merged in pull request #44.
This commit is contained in:
2026-09-28 20:01:37 +03:00
parent a4046dbe87
commit a7537da344
25 changed files with 414 additions and 547 deletions
@@ -13,8 +13,9 @@ import {
useBankCategories,
useBankExpenses,
useBankFormFocus,
useBankMutations,
useBankOperation,
useCreateBankOperation,
useUpdateBankOperation,
} from "@/entities/bank-card";
import { formatDate, formatMoney } from "@/shared/lib";
@@ -49,7 +50,8 @@ const useOperationFormVm = (props: OperationFormProps) => {
const [submittedValues, setSubmittedValues] = useState<OperationValues>();
const [error, setError] = useState<unknown>();
const categories = useBankCategories();
const mutation = useBankMutations();
const operationCreation = useCreateBankOperation();
const updateOperation = useUpdateBankOperation();
const methods = useForm<OperationValues>({
defaultValues: {
@@ -116,12 +118,12 @@ const useOperationFormVm = (props: OperationFormProps) => {
};
if (props.operation)
await mutation.updateOperation.mutateAsync({
await updateOperation.mutateAsync({
body: { ...body, version },
id: props.operation.id,
});
else
await mutation.createOperation.mutateAsync({
await operationCreation.mutateAsync({
id: intent,
...body,
});