import {Fragment} from 'react'; import Alert from 'sentry/components/alert'; import ApiForm from 'sentry/components/forms/apiForm'; import HiddenField from 'sentry/components/forms/fields/hiddenField'; import ExternalLink from 'sentry/components/links/externalLink'; import Link from 'sentry/components/links/link'; import LoadingIndicator from 'sentry/components/loadingIndicator'; import NarrowLayout from 'sentry/components/narrowLayout'; import SentryDocumentTitle from 'sentry/components/sentryDocumentTitle'; import {t, tct} from 'sentry/locale'; import type {RouteComponentProps} from 'sentry/types/legacyReactRouter'; import {useApiQuery} from 'sentry/utils/queryClient'; import {decodeScalar} from 'sentry/utils/queryString'; import {useParams} from 'sentry/utils/useParams'; type RouteParams = { id: string; orgId: string; }; type Props = RouteComponentProps; function UnsubscribeIssue({location}: Props) { const signature = decodeScalar(location.query._); const params = useParams(); return (

{t('Issue Notification Unsubscribe')}

); } interface UnsubscribeResponse { displayName: string; type: string; viewUrl: string; } type BodyProps = { issueId: string; orgSlug: string; signature?: string; }; function UnsubscribeBody({orgSlug, issueId, signature}: BodyProps) { const endpoint = `/organizations/${orgSlug}/unsubscribe/issue/${issueId}/`; const {isPending, isError, data} = useApiQuery( [endpoint, {query: {_: signature}}], {staleTime: 0} ); if (isPending) { return ; } if (isError) { return ( {t('There was an error loading unsubscribe data. Your link may have expired.')} ); } return (

{t('Account')}: {data.displayName}

{tct('You are about to unsubscribe from [docsLink] for the [viewLink].', { docsLink: ( {t('workflow notifications')} ), viewLink: {t('selected %s', data.type)}, })}

{ // Use window.location as we're going to an HTML view window.location.assign('/auth/login/'); }} onSubmitSuccess={() => { // Use window.location as we're going to an HTML view window.location.assign('/auth/login/'); }} initialData={{cancel: 1}} >
); } export default UnsubscribeIssue;