petalbid-frontend
    Preparing search index...

    Interface AuthContextType

    Defines the shape of the authentication context provided to consumers.

    interface AuthContextType {
        isLoading: boolean;
        login: (
            email: string,
            password: string,
            options?: { twoFactorCode?: string },
        ) => Promise<LoginResult>;
        logout: () => void;
        updateUser: (updatedUser: User) => void;
        user: User | null;
    }
    Index

    Properties

    isLoading: boolean

    A boolean flag indicating if the initial authentication state is being loaded or checked.

    login: (
        email: string,
        password: string,
        options?: { twoFactorCode?: string },
    ) => Promise<LoginResult>

    Logs in a user with the given credentials.

    Type Declaration

      • (
            email: string,
            password: string,
            options?: { twoFactorCode?: string },
        ): Promise<LoginResult>
      • Parameters

        • email: string

          The user's email address.

        • password: string

          The user's password.

        • Optionaloptions: { twoFactorCode?: string }

          Optional two-factor code.

        Returns Promise<LoginResult>

        A promise describing the outcome.

    logout: () => void

    Logs out the current user, clearing their session data.

    updateUser: (updatedUser: User) => void

    Updates the current user object in context and localStorage. Useful after profile updates (name/email).

    user: User | null

    The currently authenticated user object, or null if no user is logged in.