Skip to content

Commit

Permalink
Merge pull request #218 from okto-hq/main
Browse files Browse the repository at this point in the history
is ready for react and react native
  • Loading branch information
oviawork authored Jan 14, 2025
2 parents 1fdb65c + dd7a0df commit f6df104
Show file tree
Hide file tree
Showing 4 changed files with 131 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -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 |

<div className="method-box">

## Check if the SDK is initialized

`isReady`<a href="https://github.com/okto-hq/okto-sdk-react-native/blob/main/src/OktoProvider.tsx#L91" target="_blank" rel="noopener noreferrer" style= {{ textDecoration: "none" }}> <IIcon icon="lucide:external-link" height="17" style={{ display: 'inline-block', verticalAlign: 'middle' }} /></a> is a boolean flag indicating whether the Okto SDK has completed its initialization.

### Parameters

There are no parameters for this function.

### Response

<Callout title="Response">

| Field Name | Type | Description |
|------------|-----------|-----------------------------------------------------------------------------|
| `isReady` | `boolean` | Returns `true` if the SDK is initialized and ready to use |

</Callout>

<Accordions>
<Accordion title="Example">
<Tabs items={['Typescript']}>
<Tab value="Typescript">
```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]);
```
</Tab>
</Tabs>
</Accordion>
</Accordions>

</div>
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
{
"title": "Verify Login & Logout",
"title": "Session Management",
"pages": [
"login",
"isReady",
"logout"
]
}
Original file line number Diff line number Diff line change
@@ -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 |

<div className="method-box">

## Check if the SDK is initialized

`isReady`<a href="https://github.com/okto-hq/okto-sdk-react/blob/main/src/OktoProvider.tsx#L90" target="_blank" rel="noopener noreferrer" style= {{ textDecoration: "none" }}> <IIcon icon="lucide:external-link" height="17" style={{ display: 'inline-block', verticalAlign: 'middle' }} /></a> is a boolean flag indicating whether the Okto SDK has completed its initialization.

### Parameters

There are no parameters for this function.

### Response

<Callout title="Response">

| Field Name | Type | Description |
|------------|-----------|-----------------------------------------------------------------------------|
| `isReady` | `boolean` | Returns `true` if the SDK is initialized and ready to use |

</Callout>

<Accordions>
<Accordion title="Example">
<Tabs items={['Typescript']}>
<Tab value="Typescript">
```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]);
```
</Tab>
</Tabs>
</Accordion>
</Accordions>

</div>
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"title": "Session Management",
"pages": [
"login",
"isReady",
"fetch-auth-details",
"logout"
]
Expand Down

0 comments on commit f6df104

Please sign in to comment.