From 1e636066049914bdf18055abdec267f8d92ff461 Mon Sep 17 00:00:00 2001 From: zaje1 Date: Tue, 14 Jan 2025 17:52:30 +0530 Subject: [PATCH] add: isReady docs to React and React Native docs --- .../login-logout/isReady.mdx | 64 +++++++++++++++++++ .../authenticate-users/login-logout/meta.json | 3 +- .../login-logout/isReady.mdx | 64 +++++++++++++++++++ .../authenticate-users/login-logout/meta.json | 1 + 4 files changed, 131 insertions(+), 1 deletion(-) create mode 100644 content/docs/react-native-sdk/advanced-sdk-config/authenticate-users/login-logout/isReady.mdx create mode 100644 content/docs/react-sdk/advanced-sdk-config/authenticate-users/login-logout/isReady.mdx diff --git a/content/docs/react-native-sdk/advanced-sdk-config/authenticate-users/login-logout/isReady.mdx b/content/docs/react-native-sdk/advanced-sdk-config/authenticate-users/login-logout/isReady.mdx new file mode 100644 index 0000000..53c32f3 --- /dev/null +++ b/content/docs/react-native-sdk/advanced-sdk-config/authenticate-users/login-logout/isReady.mdx @@ -0,0 +1,64 @@ +--- +title: isReady +description: "Check whether the Okto SDK has completed initialization." +full: false +--- + +import { TypeTable } from 'fumadocs-ui/components/type-table'; +import { Tab, Tabs } from 'fumadocs-ui/components/tabs'; +import { Callout } from 'fumadocs-ui/components/callout'; +import { Accordion, Accordions } from 'fumadocs-ui/components/accordion'; +import { Icon as IIcon } from '@iconify/react'; + +import '../../../styles.css'; + +### Methods Overview + +| Methods | Description | +|-----------------------------------|--------------------------------------------| +| [`isReady`](#check-if-the-sdk-is-initialized) | Check if the Okto SDK has completed initialization | + +
+ +## Check if the SDK is initialized + +`isReady` is a boolean flag indicating whether the Okto SDK has completed its initialization. + +### Parameters + +There are no parameters for this function. + +### Response + + + +| Field Name | Type | Description | +|------------|-----------|-----------------------------------------------------------------------------| +| `isReady` | `boolean` | Returns `true` if the SDK is initialized and ready to use | + + + + + + + + ```typescript + import { useOkto } from 'okto-sdk-react-native'; + import { useEffect } from 'react'; + + const { isReady } = useOkto(); + + useEffect(() => { + if (!isReady) { + return; + } + // SDK is ready, safe to call Okto functions + console.log("SDK is initialized and ready to use."); + }, [isReady]); + ``` + + + + + +
diff --git a/content/docs/react-native-sdk/advanced-sdk-config/authenticate-users/login-logout/meta.json b/content/docs/react-native-sdk/advanced-sdk-config/authenticate-users/login-logout/meta.json index da9201a..92e0a74 100644 --- a/content/docs/react-native-sdk/advanced-sdk-config/authenticate-users/login-logout/meta.json +++ b/content/docs/react-native-sdk/advanced-sdk-config/authenticate-users/login-logout/meta.json @@ -1,7 +1,8 @@ { - "title": "Verify Login & Logout", + "title": "Session Management", "pages": [ "login", + "isReady", "logout" ] } \ No newline at end of file diff --git a/content/docs/react-sdk/advanced-sdk-config/authenticate-users/login-logout/isReady.mdx b/content/docs/react-sdk/advanced-sdk-config/authenticate-users/login-logout/isReady.mdx new file mode 100644 index 0000000..1acd632 --- /dev/null +++ b/content/docs/react-sdk/advanced-sdk-config/authenticate-users/login-logout/isReady.mdx @@ -0,0 +1,64 @@ +--- +title: isReady +description: "Check whether the Okto SDK has completed initialization." +full: false +--- + +import { TypeTable } from 'fumadocs-ui/components/type-table'; +import { Tab, Tabs } from 'fumadocs-ui/components/tabs'; +import { Callout } from 'fumadocs-ui/components/callout'; +import { Accordion, Accordions } from 'fumadocs-ui/components/accordion'; +import { Icon as IIcon } from '@iconify/react'; + +import '../../../styles.css'; + +### Methods Overview + +| Methods | Description | +|-----------------------------------|--------------------------------------------| +| [`isReady`](#check-if-the-sdk-is-initialized) | Check if the Okto SDK has completed initialization | + +
+ +## Check if the SDK is initialized + +`isReady` is a boolean flag indicating whether the Okto SDK has completed its initialization. + +### Parameters + +There are no parameters for this function. + +### Response + + + +| Field Name | Type | Description | +|------------|-----------|-----------------------------------------------------------------------------| +| `isReady` | `boolean` | Returns `true` if the SDK is initialized and ready to use | + + + + + + + + ```typescript + import { useOkto } from 'okto-sdk-react'; + import { useEffect } from 'react'; + + const { isReady } = useOkto(); + + useEffect(() => { + if (!isReady) { + return; + } + // SDK is ready, safe to call Okto functions + console.log("SDK is initialized and ready to use."); + }, [isReady]); + ``` + + + + + +
diff --git a/content/docs/react-sdk/advanced-sdk-config/authenticate-users/login-logout/meta.json b/content/docs/react-sdk/advanced-sdk-config/authenticate-users/login-logout/meta.json index 41259a4..108ae91 100644 --- a/content/docs/react-sdk/advanced-sdk-config/authenticate-users/login-logout/meta.json +++ b/content/docs/react-sdk/advanced-sdk-config/authenticate-users/login-logout/meta.json @@ -2,6 +2,7 @@ "title": "Session Management", "pages": [ "login", + "isReady", "fetch-auth-details", "logout" ]