refactor: enforce frontend view model boundaries
This commit is contained in:
@@ -9,6 +9,7 @@ import {
|
||||
} from "@/entities/bank-card";
|
||||
|
||||
type CardsPageVm = ReturnType<typeof useCardsPageVm>;
|
||||
|
||||
function useCardsPageVm() {
|
||||
const [parameters, setParameters] = useSearchParams();
|
||||
const period = bankPeriod(parameters);
|
||||
@@ -18,11 +19,14 @@ function useCardsPageVm() {
|
||||
const [adding, setAdding] = useState(false);
|
||||
const cards = useBankCards(archive);
|
||||
const summary = useBankSummary(period);
|
||||
|
||||
return {
|
||||
adding,
|
||||
archive,
|
||||
cards,
|
||||
categories,
|
||||
closeAdding: () => setAdding(false),
|
||||
closeCategories: () => setManagingCategories(false),
|
||||
items: cards.data?.map(card => ({
|
||||
...card,
|
||||
to: `/cards/${card.id}?${new URLSearchParams(period)}`,
|
||||
|
||||
Reference in New Issue
Block a user