Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions apps/dashboard/app/(app)/settings/root-keys/new/client.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,9 @@ export const Client: React.FC<Props> = ({ apis }) => {
},
});

const snippet = `curl -XPOST '${process.env.NEXT_PUBLIC_UNKEY_API_URL ?? "https://api.unkey.dev"}/v1/keys.createKey' \\
const snippet = `curl -XPOST '${
process.env.NEXT_PUBLIC_UNKEY_API_URL ?? "https://api.unkey.dev"
}/v1/keys.createKey' \\
-H 'Authorization: Bearer ${key.data?.key}' \\
-H 'Content-Type: application/json' \\
-d '{
Expand All @@ -122,10 +124,15 @@ export const Client: React.FC<Props> = ({ apis }) => {

const handleSetChecked = (permission: UnkeyPermission, checked: boolean) => {
setSelectedPermissions((prevPermissions) => {
const permissionSet = new Set(prevPermissions);

if (checked) {
return [...prevPermissions, permission];
permissionSet.add(permission);
} else {
permissionSet.delete(permission);
}
return prevPermissions.filter((r) => r !== permission);

return Array.from(permissionSet);
});
};

Expand Down