refactor: centralize frontend auth query gating
This commit is contained in:
@@ -8,9 +8,6 @@ import { AccountEventsPage } from "./AccountEventsPage";
|
||||
vi.mock("@/entities/brokerage-event", () => ({
|
||||
useBrokerageEvents: vi.fn(),
|
||||
}));
|
||||
vi.mock("@/features/auth", () => ({
|
||||
useAuth: () => ({ accessToken: "token" }),
|
||||
}));
|
||||
|
||||
const query = vi.mocked(useBrokerageEvents);
|
||||
|
||||
|
||||
@@ -6,13 +6,11 @@ import {
|
||||
useBrokerageEvents,
|
||||
} from "@/entities/brokerage-event";
|
||||
import { formatMoney } from "@/entities/portfolio";
|
||||
import { useAuth } from "@/features/auth";
|
||||
import { StateView } from "@/shared/ui";
|
||||
|
||||
export function AccountEventsPage() {
|
||||
const { accountId } = useParams();
|
||||
const { accessToken } = useAuth();
|
||||
const events = useBrokerageEvents(accountId, accessToken);
|
||||
const events = useBrokerageEvents(accountId);
|
||||
if (events.isLoading) return <AccountEventsPageLoading />;
|
||||
if (events.isError)
|
||||
return <AccountEventsPageError retry={() => events.refetch()} />;
|
||||
|
||||
Reference in New Issue
Block a user