26 lines
615 B
TypeScript
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 };
|