mirror of
https://bitbucket.org/wisemapping/wisemapping-frontend.git
synced 2025-03-27 15:43:58 +01:00
23 lines
553 B
TypeScript
23 lines
553 B
TypeScript
import React from 'react'
|
|
import { ErrorInfo } from '../../../classes/client'
|
|
import StyledAlert from './styled'
|
|
|
|
type GlobalErrorProps = {
|
|
error?: ErrorInfo
|
|
}
|
|
|
|
const GlobalError = (props: GlobalErrorProps): React.ReactElement | null => {
|
|
const error = props.error
|
|
const hasError = Boolean(error?.msg)
|
|
const errorMsg = error?.msg
|
|
|
|
return hasError ? (
|
|
<StyledAlert severity="error" variant="filled" hidden={!hasError}>
|
|
{' '}
|
|
{errorMsg}
|
|
</StyledAlert>
|
|
) : null
|
|
}
|
|
|
|
export default GlobalError
|