import type {RouteComponentProps} from 'react-router'; import {browserHistory} from 'react-router'; import LoadingIndicator from 'sentry/components/loadingIndicator'; import SentryDocumentTitle from 'sentry/components/sentryDocumentTitle'; import {t} from 'sentry/locale'; import type {Organization, Project, ProjectKey} from 'sentry/types'; import {setApiQueryData, useApiQuery, useQueryClient} from 'sentry/utils/queryClient'; import useApi from 'sentry/utils/useApi'; import {normalizeUrl} from 'sentry/utils/withDomainRequired'; import RouteError from 'sentry/views/routeError'; import SettingsPageHeader from 'sentry/views/settings/components/settingsPageHeader'; import PermissionAlert from 'sentry/views/settings/project/permissionAlert'; import {KeySettings} from 'sentry/views/settings/project/projectKeys/details/keySettings'; import KeyStats from 'sentry/views/settings/project/projectKeys/details/keyStats'; type Props = { organization: Organization; project: Project; } & RouteComponentProps< { keyId: string; projectId: string; }, {} >; export default function ProjectKeyDetails({organization, params, project}: Props) { const {keyId, projectId} = params; const api = useApi(); const queryClient = useQueryClient(); const { data: projKeyData, isError, isLoading, } = useApiQuery( [`/projects/${organization.slug}/${projectId}/keys/${keyId}/`], {staleTime: 0} ); function onDataChange(data: ProjectKey) { setApiQueryData( queryClient, [`/projects/${organization.slug}/${projectId}/keys/${keyId}/`], data ); } const handleRemove = () => { browserHistory.push( normalizeUrl(`/settings/${organization.slug}/projects/${projectId}/keys/`) ); }; if (isError) { return ; } if (isLoading) { return ; } return ( ); }