Skip to content

Commit

Permalink
feat(error handling): add errorpage in api call error (#658)
Browse files Browse the repository at this point in the history
  • Loading branch information
nidhigarg-bmw authored Apr 2, 2024
1 parent c06212c commit f59d2c3
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
- Add background on hover effect
- Fix notifications sorting dropdown closing issue
- Make buttons in sync
- Add ErrorHandling in Main file

### Bugfix

Expand Down
19 changes: 16 additions & 3 deletions src/components/Main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@

import { useEffect } from 'react'
import { useDispatch } from 'react-redux'
import { Outlet, useSearchParams } from 'react-router-dom'
import { CircleProgress } from '@catena-x/portal-shared-components'
import { Outlet, useNavigate, useSearchParams } from 'react-router-dom'
import { CircleProgress, ErrorPage } from '@catena-x/portal-shared-components'
import { Header } from './shared/frame/Header'
import { Footer } from './shared/frame/Footer'
import { useTranslation } from 'react-i18next'
Expand All @@ -44,11 +44,24 @@ import Redirect from './actions/Redirect'
import { OSPConsent } from './pages/OSPConsent'

export default function Main() {
const { t } = useTranslation()
const navigate = useNavigate()
document.title = useTranslation().t('title')
const [searchParams] = useSearchParams()
const dispatch = useDispatch()

const { data, isLoading } = useFetchApplicationsQuery()
const { data, isLoading, error } = useFetchApplicationsQuery()
if (error)
return (
<ErrorPage
header={t('error.tryAgain')}
title={t('error.deleteTechUserNotificationErrorDescription')}
reloadButtonTitle={t('error.tryAgain')}
onReloadClick={() => {
navigate('/')
}}
/>
)
const companyData = data?.[0]

const renderSection = () => {
Expand Down

0 comments on commit f59d2c3

Please sign in to comment.