Shopvento UI - v0.2.0
    Preparing search index...

    Function useAccountSession

    • The profile is authoritative; readable hint cookies never establish a session.

      Parameters

      • client: {
            confirmEmailChange: (
                body: EmailChangeConfirmRequest,
            ) => Promise<Record<string, string>>;
            getProfile: (signal?: AbortSignal) => Promise<ShopUserProfile>;
            getSettings: (signal?: AbortSignal) => Promise<PublicShopSettings>;
            login: (body: UserLoginRequest) => Promise<AccountLoginResponse>;
            logout: () => Promise<Record<string, string>>;
            register: (
                body: ShopUserProfileCreateRequest,
            ) => Promise<Record<string, string>>;
            requestPasswordReset: (
                body: PasswordResetRequest,
            ) => Promise<Record<string, string>>;
            setPassword: (
                body: PasswordResetConfirmRequest,
            ) => Promise<Record<string, string>>;
            verifyEmail: (
                body: EmailVerificationRequest,
            ) => Promise<Record<string, string>>;
        }
        • confirmEmailChange: (body: EmailChangeConfirmRequest) => Promise<Record<string, string>>

          Confirm a one-time email change token.

        • getProfile: (signal?: AbortSignal) => Promise<ShopUserProfile>

          Load the authoritative authenticated profile. Optional signal cancels the read.

        • getSettings: (signal?: AbortSignal) => Promise<PublicShopSettings>

          Read public installation settings. Optional signal cancels the request.

        • login: (body: UserLoginRequest) => Promise<AccountLoginResponse>

          Sign in through the host proxy; browser JSON must omit upstream access tokens.

        • logout: () => Promise<Record<string, string>>

          Invalidate the current host session.

        • register: (body: ShopUserProfileCreateRequest) => Promise<Record<string, string>>

          Request registration without revealing account existence.

        • requestPasswordReset: (body: PasswordResetRequest) => Promise<Record<string, string>>

          Request a reset email without revealing account existence.

        • setPassword: (body: PasswordResetConfirmRequest) => Promise<Record<string, string>>

          Set the account password from a one-time token.

        • verifyEmail: (body: EmailVerificationRequest) => Promise<Record<string, string>>

          Confirm a one-time email verification token.

      Returns {
          authenticated: boolean;
          error: string | null;
          loading: boolean;
          logout: () => Promise<void>;
          profile: ShopUserProfile | null;
          reload: () => void;
      }

      • authenticated: boolean

        Whether an authoritative profile is loaded.

      • error: string | null

        Customer-visible error, or null.

      • loading: boolean

        Whether the read is pending.

      • logout: () => Promise<void>

        Invalidate the current host session.

      • profile: ShopUserProfile | null

        Authoritative customer profile, or null.

      • reload: () => void

        Reload the resource from its authoritative API.