Skip to content

Commit

Permalink
feat: rename to useAuthError
Browse files Browse the repository at this point in the history
  • Loading branch information
tinaszheng committed Jun 5, 2024
1 parent 8b7d193 commit 692aa9d
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions examples/ui-demo/src/app/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
AuthType,
DemoSet,
useAuthModal,
useError,
useAuthError,
useUser,
} from "@alchemy/aa-alchemy/react";
// eslint-disable-next-line import/extensions
Expand All @@ -20,7 +20,7 @@ export default function Home() {
[]
);
const { openAuthModal } = useAuthModal();
const error = useError();
const error = useAuthError();
const user = useUser();
const { logout } = useLogout();

Expand Down
4 changes: 2 additions & 2 deletions packages/alchemy/src/react/components/auth/card/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { useAuthContext } from "../context.js";
import type { AuthType } from "../types.js";
import { Step } from "./steps.js";
import { Notification } from "../../notification.js";
import { useError } from "../../../hooks/useError.js";
import { useAuthError } from "../../../hooks/useAuthError.js";

export type AuthCardProps = {
hideError?: boolean;
Expand All @@ -28,7 +28,7 @@ export type AuthCardProps = {
export const AuthCard = (props: AuthCardProps) => {
const { status, isAuthenticating } = useSignerStatus();
const { authStep, setAuthStep } = useAuthContext();
const error = useError();
const error = useAuthError();

useLayoutEffect(() => {
if (authStep.type === "complete") {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { useAuthContext } from "../components/auth/context.js";

export type UseErrorResult = Error | undefined;
export type UseAuthErrorResult = Error | undefined;

/**
* Returns the error returned from the current auth step, if it exists
*
* @returns the current Error object
*/
export function useError(): UseErrorResult {
export function useAuthError(): UseAuthErrorResult {
const { authStep } = useAuthContext();
// TODO: generalize this, since only passkey_verify and eoa_connect have errors right now
return (
Expand Down
4 changes: 2 additions & 2 deletions packages/alchemy/src/react/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ export type * from "./hooks/useAccount.js";
export { useAccount } from "./hooks/useAccount.js";
export type * from "./hooks/useAddPasskey.js";
export { useAddPasskey } from "./hooks/useAddPasskey.js";
export type * from "./hooks/useAuthError.js";
export { useAuthError } from "./hooks/useAuthError.js";
export type * from "./hooks/useAuthenticate.js";
export { useAuthenticate } from "./hooks/useAuthenticate.js";
export type * from "./hooks/useBundlerClient.js";
Expand All @@ -19,8 +21,6 @@ export type * from "./hooks/useClientActions.js";
export { useClientActions } from "./hooks/useClientActions.js";
export type * from "./hooks/useDropAndReplaceUserOperation.js";
export { useDropAndReplaceUserOperation } from "./hooks/useDropAndReplaceUserOperation.js";
export type * from "./hooks/useError.js";
export { useError } from "./hooks/useError.js";
export type * from "./hooks/useExportAccount.js";
export { useExportAccount } from "./hooks/useExportAccount.js";
export type * from "./hooks/useLogout.js";
Expand Down

0 comments on commit 692aa9d

Please sign in to comment.