Skip to content

Commit

Permalink
final changes
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaelUnkey committed Dec 12, 2024
1 parent 63ece8e commit 5bc34f4
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 17 deletions.
4 changes: 2 additions & 2 deletions apps/docs/libraries/ts/ratelimit/override/delete-override.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,14 @@ No response, but if no error is returned the override has been deleted successfu

<RequestExample>
```ts
const override = await unkey.deleteOverride({
await unkey.deleteOverride({
identifier: "user_123",
namespaceName: "email.outbound",
})

```
```ts
const override = await unkey.deleteOverride({
await unkey.deleteOverride({
identifier: "user_123",
namespaceId:"rlns_12345",
})
Expand Down
30 changes: 15 additions & 15 deletions apps/docs/libraries/ts/ratelimit/override/overview.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -21,21 +21,21 @@ const unkey = new Override({
```ts
async function handler(request) {

const identifier = request.getUserId() // or ip or anything else you want

const override = await unkey.setOverride({
identifier: identifier,
limit: 10,
duration: 60000,
namespaceName: "email.outbound",
async: true
})
if (!override.success){
return new Response("try again later", { status: 429 })
}

// handle the request here

const identifier = request.getUserId() // or ip or anything else you want

const override = await unkey.setOverride({
identifier: identifier,
limit: 10,
duration: 60000,
namespaceName: "email.outbound",
async: true
})
if (override.error){
// handle the error here
throw new Error(override.error.message);
return;
}
// handle the request here
}
```

Expand Down

0 comments on commit 5bc34f4

Please sign in to comment.