Files
frontend/src/features/tbank-connection/ui/TbankConnectionSection/TbankConnectionSection.vm.ts
T
codex-bot 2db39f25d9
Frontend verify / commits (push) Skipped
Frontend verify / security (push) Successful in 11s
Frontend verify / verify (push) Failing after 8m19s
refactor: normalize view models and share breadcrumbs and titles (WealthLedger/frontend#143) (#153)
2026-11-04 21:14:29 +03:00

26 lines
615 B
TypeScript

import { useAuthenticatedQuery } from "@/shared/api";
import { tbankConnectionQueryOptions } from "../../model/connection-boundary";
function useTbankConnectionSectionVm() {
const status = useAuthenticatedQuery({
...tbankConnectionQueryOptions(),
});
if (!status.data) {
return status.isPending
? { state: "loading" as const }
: { retry: () => status.refetch(), state: "error" as const };
}
return {
refreshError: status.isError,
refreshing: status.isFetching,
retry: () => status.refetch(),
state: "loaded" as const,
status: status.data,
};
}
export { useTbankConnectionSectionVm };