Configure

Configures the Nutrition Advisor with the provided license key.

 /**
   * Configures the Nutrition Advisor with the provided license key.
   * @param licenseKey - The license key to configure the advisor.
   * @returns A Promise resolving to the status of the configuration.
   */
  configure(licenseKey: string): Promise<PassioAdvisorResultStatus | null>

Example

import { NutritionAdvisor } from '@passiolife/nutritionai-react-native-sdk-v3'
export type SDKStatus = 'Success' | 'Error' | 'Init'

  const [loadingState, setLoadingState] = useState<SDKStatus>('Init')

  useEffect(() => {
    async function configure() {
      try {
        const status = await NutritionAdvisor.configure(PASSIO_ADVISOR_KEY)
        switch (status?.status) {
          case 'Success':
            setLoadingState('Success')
            return
          case 'Error':
            setLoadingState('Error')
            return
        }
      } catch (err) {
        console.error(`PassioSDK Error ${err}`)
        setLoadingState('Error')
      }
    }
    configure()
  }, [])

Last updated