Skip to content

Commit

Permalink
🚧 Readme guard update
Browse files Browse the repository at this point in the history
  • Loading branch information
XionWCFM committed Aug 10, 2024
1 parent 8a1c6e8 commit 0031b96
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@

**Separate declaration and use of funnels** : For flexible design, we separate the part that defines the funnel from the part that uses it.


# Quick Start

## next.js app router
Expand Down Expand Up @@ -155,16 +154,21 @@ type FunnelOptions<T extends NonEmptyArray<string>> = {
## Guard

```tsx
interface GuardProps<T> {
condition: (() => T) | (() => Promise<T>);
type GuardProps<T = boolean> = {
condition:
| (() => T)
| (() => Promise<T>)
| boolean
| (() => boolean)
| (() => Promise<boolean>);
children?: ReactNode;
onRestrict?: (param: Awaited<T>) => void;
conditionBy?: (param: Awaited<T>) => boolean;
fallback?: ReactNode;
}
};
```

`condition` is a function that must return whether the funnel can be accessed.
`condition` must be a function or boolean that returns whether the funnel is accessible.

`onRestrict` runs when condition is false.

Expand Down

0 comments on commit 0031b96

Please sign in to comment.