1
0
mirror of synced 2026-01-01 09:04:46 -05:00
Files
docs/components/search/SearchError.tsx
Peter Bengtsson fe80f4ae4d suppress es-search if ELASTICSEARCH_URL isn't configured (#30096)
* suppress es-search if ELASTICSEARCH_URL isn't configured

* simplify

* simple 500 error instead
2022-08-19 20:54:37 +00:00

27 lines
644 B
TypeScript

import { Box, Flash } from '@primer/react'
import { useRouter } from 'next/router'
import { useTranslation } from 'components/hooks/useTranslation'
interface Props {
error: Error
}
export function SearchError({ error }: Props) {
const { t } = useTranslation('search')
const { locale, asPath } = useRouter()
return (
<div>
<Flash variant="danger" sx={{ margin: '3rem' }}>
{t('search_error')}
<br />
{process.env.NODE_ENV === 'development' && <code>{error.toString()}</code>}
</Flash>
<Box>
<a href={`/${locale}${asPath}`}>Try reloading the page</a>
</Box>
</div>
)
}