chore: error detail is updated

This commit is contained in:
Palash gupta 2022-05-13 10:38:32 +05:30
parent 6f48030ab9
commit 4b591fabf7
No known key found for this signature in database
GPG Key ID: 8FD05AE6F9150AD6

View File

@ -75,14 +75,17 @@ function ErrorDetails(): JSX.Element {
}, },
); );
// if errorType and serviceName is null redirecting to the ALL_ERROR page not now
if (errorType === null || serviceName === null) { if (errorType === null || serviceName === null) {
return <Redirect to={ROUTES.ALL_ERROR} />; return <Redirect to={ROUTES.ALL_ERROR} />;
} }
// when the api is in loading state
if (status === 'loading' || ErrorIdStatus === 'loading') { if (status === 'loading' || ErrorIdStatus === 'loading') {
return <Spinner tip="Loading.." />; return <Spinner tip="Loading.." />;
} }
// if any error occurred while loading
if (status === 'error' || ErrorIdStatus === 'error') { if (status === 'error' || ErrorIdStatus === 'error') {
return ( return (
<Typography> <Typography>
@ -91,9 +94,10 @@ function ErrorDetails(): JSX.Element {
); );
} }
// if API is successfully but there is an error
if ( if (
(status === 'success' && data?.statusCode !== 200) || (status === 'success' && data?.statusCode >= 400) ||
(ErrorIdStatus === 'success' && errorIdPayload.statusCode !== 200) (ErrorIdStatus === 'success' && errorIdPayload.statusCode >= 400)
) { ) {
return <Typography>{data?.error || defaultError}</Typography>; return <Typography>{data?.error || defaultError}</Typography>;
} }