Skip to content

armgit / dub

Public Imported from GitHub
0

The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.

small fix

Kiran K00900e51ce72
diff --git a/apps/web/app/api/tokens/route.ts b/apps/web/app/api/tokens/route.ts
index ac32b070df..dd8c048fff 100644
--- a/apps/web/app/api/tokens/route.ts
+++ b/apps/web/app/api/tokens/route.ts
@@ -18,6 +18,7 @@ export const GET = withWorkspace(
const tokens = await prisma.restrictedToken.findMany({
where: {
projectId: workspace.id,
+ clientId: null,
},
select: {
id: true,
diff --git a/apps/web/app/app.dub.co/(dashboard)/[slug]/settings/tokens/page-client.tsx b/apps/web/app/app.dub.co/(dashboard)/[slug]/settings/tokens/page-client.tsx
index d26d49657b..1ae9bfc091 100644
--- a/apps/web/app/app.dub.co/(dashboard)/[slug]/settings/tokens/page-client.tsx
+++ b/apps/web/app/app.dub.co/(dashboard)/[slug]/settings/tokens/page-client.tsx
@@ -107,8 +107,7 @@ const TokenRow = (token: TokenProps) => {
id: token.id,
name: token.name,
isMachine: token.user.isMachine,
- // @ts-ignore
- scopes: token.scopes,
+ scopes: mapScopesToResource(token.scopes),
},
});
@@ -211,3 +210,15 @@ const TokenRow = (token: TokenProps) => {
</>
);
};
+
+const mapScopesToResource = (scopes: string[]) => {
+ const result = scopes.map((scope) => {
+ const [resource] = scope.split(".");
+
+ return {
+ [resource]: scope,
+ };
+ });
+
+ return Object.assign({}, ...result);
+};