// react import { useState } from "react"; // next import { NextPage } from "next"; import { useRouter } from "next/router"; // layouts import { AppLayout } from "layouts/app-layout"; import { WorkspaceSettingLayout } from "layouts/settings-layout"; // components import DeleteTokenModal from "components/api-token/delete-token-modal"; import { WorkspaceSettingHeader } from "components/headers"; // ui import { Spinner } from "@plane/ui"; // mobx import { useMobxStore } from "lib/mobx/store-provider"; // services import { ApiTokenService } from "services/api_token.service"; // helpers import { renderDateFormat } from "helpers/date-time.helper"; // constants import { API_TOKEN_DETAILS } from "constants/fetch-keys"; // swr import useSWR from "swr"; const apiTokenService = new ApiTokenService(); const ApiTokenDetail: NextPage = () => { const { theme: themStore } = useMobxStore(); const [deleteTokenModal, setDeleteTokenModal] = useState(false); const router = useRouter(); const { workspaceSlug, tokenId } = router.query; const { data: token } = useSWR( workspaceSlug && tokenId ? API_TOKEN_DETAILS(workspaceSlug.toString(), tokenId.toString()) : null, () => workspaceSlug && tokenId ? apiTokenService.retrieveApiToken(workspaceSlug.toString(), tokenId.toString()) : null ); return ( }> setDeleteTokenModal(false)} /> {token ? (

{token.label}

{token.description}

{token.expired_at ? "Expires on " + renderDateFormat(token.expired_at, true) : "Never Expires"}

) : (
)} ); }; export default ApiTokenDetail;