-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
catch 4xx status codes, add error variable & update content view
- Loading branch information
1 parent
376e0e8
commit 2c1097e
Showing
5 changed files
with
45 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,28 @@ | ||
import React from 'react'; | ||
import { useAppSelector } from '../../hooks/reduxHooks'; | ||
import HomeButton from '../Buttons/HomeButton/HomeButton'; | ||
import ErrorComponent from '../Errors/ErrorComponent/ErrorComponent'; | ||
import Loading from '../Loading/Loading'; | ||
import QuestionForm from '../QuestionForm/QuestionForm'; | ||
|
||
const Content = () => { | ||
const { isLoggedIn } = useAppSelector((state) => state.user); | ||
const { isLoggedIn, isError } = useAppSelector((state) => state.user); | ||
|
||
return <div className="content-inner">{isLoggedIn ? <QuestionForm /> : <Loading />}</div>; | ||
const renderSecondaryContent = () => { | ||
if (isError) { | ||
return ( | ||
<ErrorComponent translationId="app.result.error"> | ||
<HomeButton /> | ||
</ErrorComponent> | ||
); | ||
} else { | ||
return <Loading />; | ||
} | ||
}; | ||
|
||
return ( | ||
<div className="content-inner">{isLoggedIn ? <QuestionForm /> : renderSecondaryContent()}</div> | ||
); | ||
}; | ||
|
||
export default Content; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters