API Reference

Listening to events

You can listen to various events in the ResetPinFlow using the onEvent prop.

import { ResetPinFlow } from '@card91/react-native-reset-pin-flow';

export function ResetPinPage() {
	const onResetPinEvent = (event) => {
  	switch (event) {
      case "C91_RESET_PIN_MISSING_PARAMETER":
        // Do something to indicate that Parameter is missing
        break;
      case "C91_RESET_PIN_AUTHENTICATION_FAILURE":
        // Do something to indicate that the API calls have Unauthorized
        break;
      case "C91_RESET_PIN_SERVER_FAILURE":
        // Do something to indicate that the API calls have Server Error
        break;
      case "C91_RESET_PIN_SUCCESS":
        // Do something to indicate that the API calls have succeeded
        break;
      case 'C91_RESET_PIN_FAIL':
        // Do something to indicate that the API calls have failed
        break;
      case "C91_OTP_SEND_FAIL":
        // Do something to indicate that the API calls have succeeded
        break;
      case 'C91_OTP_VERIFICATION_FAIL':
        // Do something to indicate that the API calls have failed
        break;
    }
  };
  
  return (
    <View>
	  	<ResetPinFlow ... onEvent={onResetPinEvent} />
		</View>
  );
}

The events are as follows:

Event NameDescription
C91_RESET_PIN_SUCCESSCalled when the server-side APIs load successfully.
C91_RESET_PIN_FAILCalled when the server-side APIs fail to load.
C91_RESET_PIN_AUTHENTICATION_FAILURECalled when Token is expired or invalid Parameter
C91_RESET_PIN_SERVER_FAILURECalled when the server-side APIs fail to load.
C91_RESET_PIN_MISSING_PARAMETERCalled when Input props are missing.
C91_OTP_SEND_FAILCalled when the server-side APIs fail to load.
C91_OTP_VERIFICATION_FAILCalled when the server-side APIs fail to load.