mirror of
https://github.com/Paris-est-Ludique/intranet.git
synced 2025-09-11 22:06:29 +02:00
move hooks inside the loginForm component instead of using props
This commit is contained in:
@@ -25,7 +25,6 @@ const HomePage: FC<Props> = (): JSX.Element => {
|
||||
return prevNotifs
|
||||
}, shallowEqual)
|
||||
|
||||
const loginError = useSelector((state: AppState) => state.volunteerLogin.error, shallowEqual)
|
||||
const jwt = useSelector((state: AppState) => state.auth.jwt, shallowEqual)
|
||||
|
||||
if (jwt === undefined) return <p>Loading...</p>
|
||||
@@ -38,7 +37,7 @@ const HomePage: FC<Props> = (): JSX.Element => {
|
||||
<div className={styles.homePage}>
|
||||
<div className={styles.loginContent}>
|
||||
<Helmet title="LoginPage" />
|
||||
<LoginForm dispatch={dispatch} error={loginError || ""} />
|
||||
<LoginForm />
|
||||
</div>
|
||||
</div>
|
||||
<div className={styles.homePage}>
|
||||
|
@@ -1,26 +1,19 @@
|
||||
import { RouteComponentProps } from "react-router-dom"
|
||||
import { useDispatch, useSelector, shallowEqual } from "react-redux"
|
||||
import React, { memo } from "react"
|
||||
import { Helmet } from "react-helmet"
|
||||
|
||||
import { AppState } from "../../store"
|
||||
import { LoginForm } from "../../components"
|
||||
import styles from "./styles.module.scss"
|
||||
|
||||
export type Props = RouteComponentProps
|
||||
|
||||
const LoginPage: React.FC<Props> = (): JSX.Element => {
|
||||
const dispatch = useDispatch()
|
||||
const loginError = useSelector((state: AppState) => state.volunteerLogin.error, shallowEqual)
|
||||
|
||||
return (
|
||||
<div className={styles.loginPage}>
|
||||
<div className={styles.loginContent}>
|
||||
<Helmet title="LoginPage" />
|
||||
<LoginForm dispatch={dispatch} error={loginError || ""} />
|
||||
</div>
|
||||
const LoginPage: React.FC<Props> = (): JSX.Element => (
|
||||
<div className={styles.loginPage}>
|
||||
<div className={styles.loginContent}>
|
||||
<Helmet title="LoginPage" />
|
||||
<LoginForm />
|
||||
</div>
|
||||
)
|
||||
}
|
||||
</div>
|
||||
)
|
||||
|
||||
export default memo(LoginPage)
|
||||
|
Reference in New Issue
Block a user