Skip to content

Commit f1bae8a

Browse files
committed
docs: fix docs
1 parent aae79be commit f1bae8a

File tree

5 files changed

+10
-61
lines changed

5 files changed

+10
-61
lines changed

.github/workflows/publish.yml

Lines changed: 0 additions & 46 deletions
This file was deleted.

README.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,8 @@ To get started, add a `#### Conditions` subheading to the feature issue and list
204204

205205
- [ ] Only if admin
206206

207+
```
208+
207209
Now define how the condition is evaluated during runtime.
208210

209211
1. Define a `requestToContext` function that takes a request object and returns a context object. The context object is passed to the condition functions.
@@ -212,6 +214,7 @@ Now define how the condition is evaluated during runtime.
212214
The `requestToContext` is a good place to extract information from the request object that is needed to evaluate the conditions. For example, you can extract cookies or headers from the request object to determine if a user is signed in.
213215

214216
> ‼️ Important: The `requestToContext` function is only called when communicating with the `NextFlag` API over HTTP. If you are using the `NextFlag` directly in a server-side component, you must build the context object yourself and pass it to the `isFeatureEnabled` method directly.
217+
```
215218

216219
```ts
217220
// src/app/api/next-flag/index.ts
@@ -239,7 +242,6 @@ export const nf = new NextFlag({
239242
},
240243
});
241244
```
242-
````
243245

244246
```ts
245247
// src/app/page.tsx
@@ -449,3 +451,4 @@ If you don't want to use a Webhook simply omit the `NEXT_FLAG_WEBHOOK_SECRET` fr
449451
| `POST` | `(req: NextRequest) => Promise<NextResponse<{ error: string; }> or NextResponse<{ success: boolean; }>>` |
450452

451453
<!-- TSDOC_END -->
454+
````

examples/nextjs-example/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
},
1111
"dependencies": {
1212
"next": "14.2.3",
13-
"next-flag": "^1.2.0",
13+
"next-flag": "^1.2.1",
1414
"react": "^18",
1515
"react-dom": "^18"
1616
},

examples/nextjs-example/pnpm-lock.yaml

Lines changed: 5 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

examples/nextjs-example/src/app/api/next-flag/index.ts

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,8 @@ export const nf = new NextFlag({
66
{
77
repository: 'TimMikeladze/next-flag',
88
issue: 3,
9-
conditions: {
10-
'only-if-admin': (context) => context.isAdmin,
11-
},
129
},
1310
],
14-
async requestToContext(req) {
15-
return {
16-
isAdmin: false,
17-
};
18-
},
1911
cache: {
2012
revalidateTag,
2113
unstable_cache,

0 commit comments

Comments
 (0)