From 0031b9680f19e4ffb4cb6734c6d3622e1f8c1d48 Mon Sep 17 00:00:00 2001 From: devgiljong Date: Sun, 11 Aug 2024 02:31:57 +0900 Subject: [PATCH] :construction: Readme guard update --- README.md | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 6b39de7..ad80e6c 100644 --- a/README.md +++ b/README.md @@ -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 @@ -155,16 +154,21 @@ type FunnelOptions> = { ## Guard ```tsx -interface GuardProps { - condition: (() => T) | (() => Promise); +type GuardProps = { + condition: + | (() => T) + | (() => Promise) + | boolean + | (() => boolean) + | (() => Promise); children?: ReactNode; onRestrict?: (param: Awaited) => void; conditionBy?: (param: Awaited) => 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.