Skip to main content

Overview

useUpdateUserProfile hook is used to handle the process of updating a user’s profile. It leverages the react-query library to manage the asynchronous operation and provides error handling and success callbacks.

Parameters

onSuccess
() => void
required
callback function that is called when the profile update process is successful.
onError
HttpErrorCallback
required
callback function that is called when an error occurs during the profile update process.
HttpErrorCallback type
type HttpErrorCallback = (error: HttpError | Error | undefined) => void;

Returns

updateUserProfile
(payload: UpdateUserProfileRequest) => void
function that triggers the profile update process with the provided payload.
UpdateUserProfileRequest type
type UpdateUserProfileRequest = {
  firstName?: string;
  lastName?: string;
  phoneNumber?: string;
  metadata?: Record<string, string>;
};
isLoading
boolean
boolean indicating whether the profile update process is currently in progress.
isError
boolean
boolean indicating whether an error occurred during the profile update process.
error
HttpError | Error | null
error object if an error occurred during the profile update process.