-
-
Notifications
You must be signed in to change notification settings - Fork 425
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
52 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 16 additions & 26 deletions
42
apps/web/src/app/app/[workspaceSlug]/(dashboard)/settings/api-token/_components/card.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 20 additions & 2 deletions
22
apps/web/src/app/app/[workspaceSlug]/(dashboard)/settings/api-token/page.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,26 @@ | ||
import { Unkey } from "@unkey/api"; | ||
|
||
import { env } from "@/env"; | ||
import { api } from "@/trpc/server"; | ||
import { ApiKeys } from "./_components/card"; | ||
|
||
export const revalidate = 0; | ||
|
||
const unkey = new Unkey({ token: env.UNKEY_TOKEN, cache: "no-cache" }); | ||
|
||
export default async function ApiTokenPage() { | ||
const data = await api.workspace.getWorkspace.query(); | ||
const workspace = await api.workspace.getWorkspace.query(); | ||
|
||
const data = await unkey.apis.listKeys({ | ||
apiId: env.UNKEY_API_ID, | ||
ownerId: String(workspace.id), | ||
}); | ||
|
||
if (data.error) { | ||
return <div>Something went wrong. Please contact us.</div>; | ||
} | ||
|
||
const value = data.result.keys?.[0] || undefined; | ||
|
||
return <ApiKeys ownerId={data.id} />; | ||
return <ApiKeys ownerId={workspace.id} value={value} />; | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.