Skip to content

Commit

Permalink
API Keys in settings
Browse files Browse the repository at this point in the history
  • Loading branch information
chitalian committed Sep 19, 2024
1 parent d919f5f commit 250169f
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 1 deletion.
8 changes: 7 additions & 1 deletion web/components/templates/settings/settingsLayout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
UserGroupIcon,
} from "@heroicons/react/24/outline";
import { Divider } from "@tremor/react";
import { LinkIcon } from "lucide-react";
import { KeyIcon, LinkIcon } from "lucide-react";
import Link from "next/link";
import { useRouter } from "next/router";
import { ReactNode } from "react";
Expand All @@ -18,6 +18,12 @@ const tabs = [
icon: BuildingOfficeIcon,
href: "/settings",
},
{
id: "api-keys",
title: "API Keys",
icon: KeyIcon,
href: "/settings/api-keys",
},
{
id: "connections",
title: "Connections",
Expand Down
42 changes: 42 additions & 0 deletions web/pages/settings/api-keys.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import KeyPage from "@/components/templates/keys/keyPage";
import SettingsLayout from "@/components/templates/settings/settingsLayout";
import { ReactElement } from "react";
import AuthLayout from "../../components/layout/auth/authLayout";
import { withAuthSSR } from "../../lib/api/handlerWrappers";
import { SortDirection } from "../../services/lib/sorts/requests/sorts";

const Connections = () => {
return <KeyPage />;
};

Connections.getLayout = function getLayout(page: ReactElement) {
return (
<AuthLayout>
<SettingsLayout>{page}</SettingsLayout>
</AuthLayout>
);
};

export default Connections;

export const getServerSideProps = withAuthSSR(async (options) => {
const { page, page_size, sortKey, sortDirection, isCustomProperty, tab } =
options.context.query;

const currentPage = parseInt(page as string, 10) || 1;
const pageSize = parseInt(page_size as string, 10) || 10;

return {
props: {
user: options.userData.user,
currentPage,
pageSize,
sort: {
sortKey: sortKey ? (sortKey as string) : null,
sortDirection: sortDirection ? (sortDirection as SortDirection) : null,
isCustomProperty: isCustomProperty === "true",
},
defaultIndex: tab ? parseInt(tab as string) : 0,
},
};
});

0 comments on commit 250169f

Please sign in to comment.