12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667 |
- import {useEffect, useState} from 'react';
- import {RouteComponentProps} from 'react-router';
- import DetailedError from 'sentry/components/errors/detailedError';
- import * as Layout from 'sentry/components/layouts/thirds';
- import {t} from 'sentry/locale';
- type Props = RouteComponentProps<{}, {}>;
- function ProjectEventRedirect({router}: Props) {
- const [error, setError] = useState<string | null>(null);
- useEffect(() => {
-
-
-
- const endpoint = router.location.pathname;
-
-
-
-
-
- const xhr = new XMLHttpRequest();
-
-
-
- xhr.open('HEAD', endpoint);
- xhr.send();
- xhr.onload = () => {
- if (xhr.status === 404) {
- setError(t('Could not find an issue for the provided event id'));
- return;
- }
-
-
-
-
-
- router.replace(xhr.responseURL);
- };
- xhr.onerror = () => {
- setError(t('Could not load the requested event'));
- };
- });
- return error ? (
- <DetailedError heading={t('Not found')} message={error} hideSupportLinks />
- ) : (
- <Layout.Page withPadding />
- );
- }
- export default ProjectEventRedirect;
|