File size: 944 Bytes
f5071ca |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
import React from 'react'
import './ErrorPage.css'
/**
* I have to check for error message or simply an error because of I've handled errors in the
* reducers. The RTK documentation recommends checking for a promise rejection with value or
* with an error; thus, when it rejects with value, there will be a status_message, and if that
* doesn't happen, there will simply be an error object
*/
const ErrorPage = props => {
const { errors } = props
let errorObjs
if (Array.isArray(errors)) {
errorObjs = errors[0] || errors[1] || errors[2]
}
const errorType = errorObjs || errors
const errorMessage = errorType.message ? errorType.message : errorType
return (
<div className="ErrorPage">
<div className="ErrorPage-Items">
<h2>No matching tiles found.</h2>
<h2>{errorMessage}</h2>
</div>
</div>
)
}
export default ErrorPage |