From 5bc34f434a883986cccb601aa8394315ea0a0d7c Mon Sep 17 00:00:00 2001 From: Michael Silva Date: Thu, 12 Dec 2024 14:39:39 -0500 Subject: [PATCH] final changes --- .../ts/ratelimit/override/delete-override.mdx | 4 +-- .../ts/ratelimit/override/overview.mdx | 30 +++++++++---------- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/apps/docs/libraries/ts/ratelimit/override/delete-override.mdx b/apps/docs/libraries/ts/ratelimit/override/delete-override.mdx index 9f45cd73b..69c1e5efe 100644 --- a/apps/docs/libraries/ts/ratelimit/override/delete-override.mdx +++ b/apps/docs/libraries/ts/ratelimit/override/delete-override.mdx @@ -28,14 +28,14 @@ No response, but if no error is returned the override has been deleted successfu ```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", }) diff --git a/apps/docs/libraries/ts/ratelimit/override/overview.mdx b/apps/docs/libraries/ts/ratelimit/override/overview.mdx index 73bca3395..7c69a3c40 100644 --- a/apps/docs/libraries/ts/ratelimit/override/overview.mdx +++ b/apps/docs/libraries/ts/ratelimit/override/overview.mdx @@ -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 } ```