mirror of
https://github.com/Paris-est-Ludique/intranet.git
synced 2025-06-09 17:14:21 +02:00
Add login form on pages where login is needed
This commit is contained in:
parent
9338748b31
commit
ef4d1e40ba
@ -4,6 +4,7 @@ import { fetchVolunteerAsksSet } from "../../store/volunteerAsksSet"
|
|||||||
import { useAskTools, addAsk, answerLaterOnProfileBefore } from "./utils"
|
import { useAskTools, addAsk, answerLaterOnProfileBefore } from "./utils"
|
||||||
import MealsForm, { fetchFor as fetchForMealsForm } from "../VolunteerBoard/MealsForm/MealsForm"
|
import MealsForm, { fetchFor as fetchForMealsForm } from "../VolunteerBoard/MealsForm/MealsForm"
|
||||||
import { useUserMeals } from "../VolunteerBoard/meals.utils"
|
import { useUserMeals } from "../VolunteerBoard/meals.utils"
|
||||||
|
import { useUserDayWishes } from "../VolunteerBoard/daysWishes.utils"
|
||||||
|
|
||||||
export function AskMeals(asks: JSX.Element[], id: number): void {
|
export function AskMeals(asks: JSX.Element[], id: number): void {
|
||||||
const { dispatch, jwtToken, volunteerAsks } = useAskTools()
|
const { dispatch, jwtToken, volunteerAsks } = useAskTools()
|
||||||
@ -17,8 +18,11 @@ export function AskMeals(asks: JSX.Element[], id: number): void {
|
|||||||
}, [dispatch, id, jwtToken, volunteerAsks?.hiddenAsks])
|
}, [dispatch, id, jwtToken, volunteerAsks?.hiddenAsks])
|
||||||
|
|
||||||
const [userMeals] = useUserMeals()
|
const [userMeals] = useUserMeals()
|
||||||
|
const [userWishes] = useUserDayWishes()
|
||||||
|
const participation = get(userWishes, "active", "inconnu") as string
|
||||||
const meals = get(userMeals, "meals", [])
|
const meals = get(userMeals, "meals", [])
|
||||||
const needToShow = meals.length === 0
|
const needToShow =
|
||||||
|
(participation === "oui" || participation === "peut-etre") && meals.length === 0
|
||||||
|
|
||||||
addAsk(
|
addAsk(
|
||||||
asks,
|
asks,
|
||||||
|
@ -6,6 +6,7 @@ import ParticipationDetailsForm, {
|
|||||||
fetchFor as fetchForParticipationDetailsForm,
|
fetchFor as fetchForParticipationDetailsForm,
|
||||||
} from "../VolunteerBoard/ParticipationDetailsForm/ParticipationDetailsForm"
|
} from "../VolunteerBoard/ParticipationDetailsForm/ParticipationDetailsForm"
|
||||||
import { useUserParticipationDetails } from "../VolunteerBoard/participationDetails.utils"
|
import { useUserParticipationDetails } from "../VolunteerBoard/participationDetails.utils"
|
||||||
|
import { useUserDayWishes } from "../VolunteerBoard/daysWishes.utils"
|
||||||
|
|
||||||
export function AskParticipationDetails(asks: JSX.Element[], id: number): void {
|
export function AskParticipationDetails(asks: JSX.Element[], id: number): void {
|
||||||
const { dispatch, jwtToken, volunteerAsks } = useAskTools()
|
const { dispatch, jwtToken, volunteerAsks } = useAskTools()
|
||||||
@ -19,9 +20,12 @@ export function AskParticipationDetails(asks: JSX.Element[], id: number): void {
|
|||||||
}, [dispatch, id, jwtToken, volunteerAsks?.hiddenAsks])
|
}, [dispatch, id, jwtToken, volunteerAsks?.hiddenAsks])
|
||||||
|
|
||||||
const [participationDetails] = useUserParticipationDetails()
|
const [participationDetails] = useUserParticipationDetails()
|
||||||
|
const [userWishes] = useUserDayWishes()
|
||||||
|
const participation = get(userWishes, "active", "inconnu") as string
|
||||||
const tshirtSize = get(participationDetails, "tshirtSize", "")
|
const tshirtSize = get(participationDetails, "tshirtSize", "")
|
||||||
const food = get(participationDetails, "food", "")
|
const food = get(participationDetails, "food", "")
|
||||||
const needToShow = !tshirtSize || !food
|
const needToShow =
|
||||||
|
(participation === "oui" || participation === "peut-etre") && (!tshirtSize || !food)
|
||||||
|
|
||||||
addAsk(
|
addAsk(
|
||||||
asks,
|
asks,
|
||||||
|
@ -46,7 +46,7 @@ const Asks = (): JSX.Element | null => {
|
|||||||
dans <a href="/profil">Mon profil</a> :)
|
dans <a href="/profil">Mon profil</a> :)
|
||||||
<br />
|
<br />
|
||||||
Tu as fait le tour des dernières infos ou questions importantes,
|
Tu as fait le tour des dernières infos ou questions importantes,
|
||||||
merci ! :)
|
merci !
|
||||||
<br />
|
<br />
|
||||||
Nous te préviendrons quand il y en aura de nouvelles.
|
Nous te préviendrons quand il y en aura de nouvelles.
|
||||||
<br />
|
<br />
|
||||||
|
@ -2,11 +2,16 @@ import { memo, useCallback, useRef } from "react"
|
|||||||
import { get } from "lodash"
|
import { get } from "lodash"
|
||||||
import { shallowEqual, useDispatch, useSelector } from "react-redux"
|
import { shallowEqual, useDispatch, useSelector } from "react-redux"
|
||||||
import { AppState } from "../../store"
|
import { AppState } from "../../store"
|
||||||
import { fetchVolunteerLogin } from "../../store/volunteerLogin"
|
import { fetchVolunteerLogin, fetchVolunteerLoginToRoot } from "../../store/volunteerLogin"
|
||||||
import styles from "./styles.module.scss"
|
import styles from "./styles.module.scss"
|
||||||
import FormSubmit from "../Form/FormSubmit/FormSubmit"
|
import FormSubmit from "../Form/FormSubmit/FormSubmit"
|
||||||
|
|
||||||
const LoginForm = (): JSX.Element => {
|
interface Props {
|
||||||
|
redirectToRoot?: boolean
|
||||||
|
loginNeeded?: boolean
|
||||||
|
}
|
||||||
|
|
||||||
|
const LoginForm = ({ redirectToRoot, loginNeeded }: Props): JSX.Element => {
|
||||||
const dispatch = useDispatch()
|
const dispatch = useDispatch()
|
||||||
const loginError = useSelector((state: AppState) => state.volunteerLogin.error, shallowEqual)
|
const loginError = useSelector((state: AppState) => state.volunteerLogin.error, shallowEqual)
|
||||||
|
|
||||||
@ -20,17 +25,19 @@ const LoginForm = (): JSX.Element => {
|
|||||||
const email = get(emailRef, "current.value", "")
|
const email = get(emailRef, "current.value", "")
|
||||||
const password = get(passwordRef, "current.value", "")
|
const password = get(passwordRef, "current.value", "")
|
||||||
|
|
||||||
dispatch(fetchVolunteerLogin({ email, password }))
|
dispatch(
|
||||||
|
(redirectToRoot ? fetchVolunteerLoginToRoot : fetchVolunteerLogin)({
|
||||||
|
email,
|
||||||
|
password,
|
||||||
|
})
|
||||||
|
)
|
||||||
return false
|
return false
|
||||||
},
|
},
|
||||||
[dispatch]
|
[dispatch, redirectToRoot]
|
||||||
)
|
)
|
||||||
|
|
||||||
return (
|
const loginForm = (
|
||||||
<form>
|
<form>
|
||||||
<div className={styles.loginIntro} key="login-intro">
|
|
||||||
Si tu es bénévole ou que tu l'as déjà été, connecte-toi pour accéder à ton espace.
|
|
||||||
</div>
|
|
||||||
<div className={styles.formLine} key="line-email">
|
<div className={styles.formLine} key="line-email">
|
||||||
<label htmlFor="email">Email</label>
|
<label htmlFor="email">Email</label>
|
||||||
<input type="email" id="email" name="utilisateur" ref={emailRef} />
|
<input type="email" id="email" name="utilisateur" ref={emailRef} />
|
||||||
@ -48,6 +55,38 @@ const LoginForm = (): JSX.Element => {
|
|||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
)
|
)
|
||||||
|
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
{loginNeeded && (
|
||||||
|
<div className={styles.loginPage}>
|
||||||
|
<div className={styles.loginContent}>
|
||||||
|
<div className={styles.loginIntro}>
|
||||||
|
Tu dois t'identifier pour accéder à cette page !
|
||||||
|
</div>
|
||||||
|
{loginForm}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
|
||||||
|
{redirectToRoot && loginForm}
|
||||||
|
|
||||||
|
{!loginNeeded && !redirectToRoot && (
|
||||||
|
<>
|
||||||
|
<div className={styles.loginIntro} key="login-intro">
|
||||||
|
Si tu es bénévole ou que tu l'as déjà été, connecte-toi pour accéder à ton
|
||||||
|
espace.
|
||||||
|
</div>
|
||||||
|
{loginForm}
|
||||||
|
</>
|
||||||
|
)}
|
||||||
|
</>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
// Set default props
|
||||||
|
LoginForm.defaultProps = {
|
||||||
|
redirectToRoot: undefined,
|
||||||
|
loginNeeded: undefined,
|
||||||
}
|
}
|
||||||
|
|
||||||
export default memo(LoginForm)
|
export default memo(LoginForm)
|
||||||
|
@ -1,6 +1,14 @@
|
|||||||
@import "../../theme/variables";
|
@import "../../theme/variables";
|
||||||
@import "../../theme/mixins";
|
@import "../../theme/mixins";
|
||||||
|
|
||||||
|
.loginPage {
|
||||||
|
@include page-wrapper-center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.loginContent {
|
||||||
|
@include page-content-wrapper;
|
||||||
|
}
|
||||||
|
|
||||||
.loginIntro {
|
.loginIntro {
|
||||||
margin-bottom: 10px;
|
margin-bottom: 10px;
|
||||||
}
|
}
|
||||||
|
@ -256,7 +256,7 @@ const RegisterForm = ({ dispatch }: Props): JSX.Element => {
|
|||||||
</dl>
|
</dl>
|
||||||
)
|
)
|
||||||
|
|
||||||
const cameAsVisitor = (
|
const alreadySignupForm = (
|
||||||
<>
|
<>
|
||||||
<div className={styles.inputWrapper}>
|
<div className={styles.inputWrapper}>
|
||||||
<div className={styles.leftCol}>
|
<div className={styles.leftCol}>
|
||||||
@ -294,11 +294,15 @@ const RegisterForm = ({ dispatch }: Props): JSX.Element => {
|
|||||||
Viens simplement t'identifier sur <a href="/">fo.parisestludique.fr</a>{" "}
|
Viens simplement t'identifier sur <a href="/">fo.parisestludique.fr</a>{" "}
|
||||||
ou en dessous ^^
|
ou en dessous ^^
|
||||||
</p>
|
</p>
|
||||||
<LoginForm />
|
<LoginForm redirectToRoot />
|
||||||
</dd>
|
</dd>
|
||||||
</dl>
|
</dl>
|
||||||
)}
|
)}
|
||||||
|
</>
|
||||||
|
)
|
||||||
|
|
||||||
|
const cameAsVisitor = (
|
||||||
|
<>
|
||||||
<div className={styles.inputWrapper}>
|
<div className={styles.inputWrapper}>
|
||||||
<div className={styles.leftCol}>
|
<div className={styles.leftCol}>
|
||||||
<div className={styles.multipleChoiceTitle}>
|
<div className={styles.multipleChoiceTitle}>
|
||||||
@ -668,16 +672,21 @@ const RegisterForm = ({ dispatch }: Props): JSX.Element => {
|
|||||||
)
|
)
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<form>
|
<>
|
||||||
{intro}
|
{intro}
|
||||||
{enableRegistering && commentQuestion}
|
{enableRegistering && commentQuestion}
|
||||||
{cameAsVisitor}
|
{alreadySignupForm}
|
||||||
{meeting}
|
{!alreadySignup && (
|
||||||
{pelMember}
|
<form>
|
||||||
{nameMobileEmail}
|
{cameAsVisitor}
|
||||||
{!enableRegistering && commentQuestion}
|
{meeting}
|
||||||
{howToContact !== "Aucun" && submitButton}
|
{pelMember}
|
||||||
</form>
|
{nameMobileEmail}
|
||||||
|
{!enableRegistering && commentQuestion}
|
||||||
|
{howToContact !== "Aucun" && submitButton}
|
||||||
|
</form>
|
||||||
|
)}
|
||||||
|
</>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4,7 +4,7 @@ import { useSelector } from "react-redux"
|
|||||||
|
|
||||||
import { AppThunk } from "../../../store"
|
import { AppThunk } from "../../../store"
|
||||||
import { selectUserJwtToken } from "../../../store/auth"
|
import { selectUserJwtToken } from "../../../store/auth"
|
||||||
import { DbEdit, fetchForDbEdit } from "../../../components"
|
import { DbEdit, fetchForDbEdit, LoginForm } from "../../../components"
|
||||||
|
|
||||||
export type Props = RouteComponentProps
|
export type Props = RouteComponentProps
|
||||||
|
|
||||||
@ -19,7 +19,7 @@ const DbEditPage: FC<Props> = (): JSX.Element => {
|
|||||||
</>
|
</>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
return <div>Besoin d'être identifié</div>
|
return <LoginForm loginNeeded />
|
||||||
}
|
}
|
||||||
|
|
||||||
// Fetch server-side data here
|
// Fetch server-side data here
|
||||||
|
@ -4,7 +4,7 @@ import { useSelector } from "react-redux"
|
|||||||
|
|
||||||
import { AppThunk } from "../../../store"
|
import { AppThunk } from "../../../store"
|
||||||
import { selectUserJwtToken } from "../../../store/auth"
|
import { selectUserJwtToken } from "../../../store/auth"
|
||||||
import { GameDetailsUpdate } from "../../../components"
|
import { GameDetailsUpdate, LoginForm } from "../../../components"
|
||||||
import { fetchGameDetailsUpdateIfNeed } from "../../../store/gameDetailsUpdate"
|
import { fetchGameDetailsUpdateIfNeed } from "../../../store/gameDetailsUpdate"
|
||||||
|
|
||||||
export type Props = RouteComponentProps
|
export type Props = RouteComponentProps
|
||||||
@ -20,7 +20,7 @@ const GameDetailsUpdatePage: FC<Props> = (): JSX.Element => {
|
|||||||
</>
|
</>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
return <div>Besoin d'être identifié</div>
|
return <LoginForm loginNeeded />
|
||||||
}
|
}
|
||||||
|
|
||||||
// Fetch server-side data here
|
// Fetch server-side data here
|
||||||
|
@ -5,7 +5,7 @@ import { useSelector } from "react-redux"
|
|||||||
import { AppThunk } from "../../store"
|
import { AppThunk } from "../../store"
|
||||||
import { selectUserJwtToken } from "../../store/auth"
|
import { selectUserJwtToken } from "../../store/auth"
|
||||||
import Page from "../../components/ui/Page/Page"
|
import Page from "../../components/ui/Page/Page"
|
||||||
import { Board, fetchForBoard } from "../../components"
|
import { Board, fetchForBoard, LoginForm } from "../../components"
|
||||||
|
|
||||||
export type Props = RouteComponentProps
|
export type Props = RouteComponentProps
|
||||||
|
|
||||||
@ -20,7 +20,7 @@ const BoardPage: FC<Props> = (): JSX.Element => {
|
|||||||
</Page>
|
</Page>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
return <div>Besoin d'être identifié</div>
|
return <LoginForm loginNeeded />
|
||||||
}
|
}
|
||||||
|
|
||||||
// Fetch server-side data here
|
// Fetch server-side data here
|
||||||
|
@ -5,7 +5,7 @@ import { Helmet } from "react-helmet"
|
|||||||
|
|
||||||
import { AppThunk } from "../../store"
|
import { AppThunk } from "../../store"
|
||||||
import styles from "./styles.module.scss"
|
import styles from "./styles.module.scss"
|
||||||
import { KnowledgeBoxList, KnowledgeIntro, fetchForKnowledge } from "../../components"
|
import { KnowledgeBoxList, KnowledgeIntro, LoginForm, fetchForKnowledge } from "../../components"
|
||||||
import { selectUserJwtToken } from "../../store/auth"
|
import { selectUserJwtToken } from "../../store/auth"
|
||||||
|
|
||||||
export type Props = RouteComponentProps
|
export type Props = RouteComponentProps
|
||||||
@ -14,7 +14,7 @@ const KnowledgesPage: FC<Props> = (): JSX.Element => {
|
|||||||
const jwtToken = useSelector(selectUserJwtToken)
|
const jwtToken = useSelector(selectUserJwtToken)
|
||||||
if (jwtToken === undefined) return <p>Loading...</p>
|
if (jwtToken === undefined) return <p>Loading...</p>
|
||||||
if (!jwtToken) {
|
if (!jwtToken) {
|
||||||
return <div>Besoin d'être identifié</div>
|
return <LoginForm loginNeeded />
|
||||||
}
|
}
|
||||||
return (
|
return (
|
||||||
<div className={styles.knowledgesPage}>
|
<div className={styles.knowledgesPage}>
|
||||||
|
@ -3,7 +3,7 @@ import { useSelector } from "react-redux"
|
|||||||
import { RouteComponentProps } from "react-router-dom"
|
import { RouteComponentProps } from "react-router-dom"
|
||||||
|
|
||||||
import { AppThunk } from "../../store"
|
import { AppThunk } from "../../store"
|
||||||
import { KnowledgeCard, fetchForKnowledgeCard } from "../../components"
|
import { KnowledgeCard, fetchForKnowledgeCard, LoginForm } from "../../components"
|
||||||
import { selectUserJwtToken } from "../../store/auth"
|
import { selectUserJwtToken } from "../../store/auth"
|
||||||
|
|
||||||
export type Props = RouteComponentProps
|
export type Props = RouteComponentProps
|
||||||
@ -12,7 +12,7 @@ const KnowledgeCardsPage: FC<Props> = (): JSX.Element => {
|
|||||||
const jwtToken = useSelector(selectUserJwtToken)
|
const jwtToken = useSelector(selectUserJwtToken)
|
||||||
if (jwtToken === undefined) return <p>Loading...</p>
|
if (jwtToken === undefined) return <p>Loading...</p>
|
||||||
if (!jwtToken) {
|
if (!jwtToken) {
|
||||||
return <div>Besoin d'être identifié</div>
|
return <LoginForm loginNeeded />
|
||||||
}
|
}
|
||||||
return <KnowledgeCard />
|
return <KnowledgeCard />
|
||||||
}
|
}
|
||||||
|
@ -5,7 +5,7 @@ import { Helmet } from "react-helmet"
|
|||||||
|
|
||||||
import { AppThunk } from "../../store"
|
import { AppThunk } from "../../store"
|
||||||
import styles from "./styles.module.scss"
|
import styles from "./styles.module.scss"
|
||||||
import { LoaningIntro, Loaning, fetchForLoaning } from "../../components"
|
import { LoaningIntro, Loaning, fetchForLoaning, LoginForm } from "../../components"
|
||||||
import { selectUserJwtToken } from "../../store/auth"
|
import { selectUserJwtToken } from "../../store/auth"
|
||||||
|
|
||||||
export type Props = RouteComponentProps
|
export type Props = RouteComponentProps
|
||||||
@ -14,7 +14,7 @@ const LoaningPage: FC<Props> = (): JSX.Element => {
|
|||||||
const jwtToken = useSelector(selectUserJwtToken)
|
const jwtToken = useSelector(selectUserJwtToken)
|
||||||
if (jwtToken === undefined) return <p>Loading...</p>
|
if (jwtToken === undefined) return <p>Loading...</p>
|
||||||
if (!jwtToken) {
|
if (!jwtToken) {
|
||||||
return <div>Besoin d'être identifié</div>
|
return <LoginForm loginNeeded />
|
||||||
}
|
}
|
||||||
return (
|
return (
|
||||||
<div className={styles.loaningPage}>
|
<div className={styles.loaningPage}>
|
||||||
|
@ -5,7 +5,7 @@ import { Helmet } from "react-helmet"
|
|||||||
|
|
||||||
import { AppThunk } from "../../store"
|
import { AppThunk } from "../../store"
|
||||||
import styles from "./styles.module.scss"
|
import styles from "./styles.module.scss"
|
||||||
import { LoansIntro, Loans, fetchForLoans } from "../../components"
|
import { LoansIntro, Loans, fetchForLoans, LoginForm } from "../../components"
|
||||||
import { selectUserJwtToken } from "../../store/auth"
|
import { selectUserJwtToken } from "../../store/auth"
|
||||||
|
|
||||||
export type Props = RouteComponentProps
|
export type Props = RouteComponentProps
|
||||||
@ -14,7 +14,7 @@ const LoansPage: FC<Props> = (): JSX.Element => {
|
|||||||
const jwtToken = useSelector(selectUserJwtToken)
|
const jwtToken = useSelector(selectUserJwtToken)
|
||||||
if (jwtToken === undefined) return <p>Loading...</p>
|
if (jwtToken === undefined) return <p>Loading...</p>
|
||||||
if (!jwtToken) {
|
if (!jwtToken) {
|
||||||
return <div>Besoin d'être identifié</div>
|
return <LoginForm loginNeeded />
|
||||||
}
|
}
|
||||||
return (
|
return (
|
||||||
<div className={styles.loaningPage}>
|
<div className={styles.loaningPage}>
|
||||||
|
@ -5,7 +5,7 @@ import { useSelector } from "react-redux"
|
|||||||
import { AppThunk } from "../../store"
|
import { AppThunk } from "../../store"
|
||||||
import { selectUserJwtToken } from "../../store/auth"
|
import { selectUserJwtToken } from "../../store/auth"
|
||||||
import Page from "../../components/ui/Page/Page"
|
import Page from "../../components/ui/Page/Page"
|
||||||
import { TeamAssignment, fetchForTeamAssignment } from "../../components"
|
import { TeamAssignment, fetchForTeamAssignment, LoginForm } from "../../components"
|
||||||
import VolunteersWithTeamWishes from "../../components/TeamAssignment/VolunteersWithTeamWishes"
|
import VolunteersWithTeamWishes from "../../components/TeamAssignment/VolunteersWithTeamWishes"
|
||||||
|
|
||||||
export type Props = RouteComponentProps
|
export type Props = RouteComponentProps
|
||||||
@ -26,7 +26,7 @@ const TeamAssignmentPage: FC<Props> = (): JSX.Element => {
|
|||||||
</>
|
</>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
return <div>Besoin d'être identifié</div>
|
return <LoginForm loginNeeded />
|
||||||
}
|
}
|
||||||
|
|
||||||
// Fetch server-side data here
|
// Fetch server-side data here
|
||||||
|
@ -5,6 +5,7 @@ import { useSelector } from "react-redux"
|
|||||||
import { AppThunk } from "../../store"
|
import { AppThunk } from "../../store"
|
||||||
import { selectUserJwtToken } from "../../store/auth"
|
import { selectUserJwtToken } from "../../store/auth"
|
||||||
import Page from "../../components/ui/Page/Page"
|
import Page from "../../components/ui/Page/Page"
|
||||||
|
import { LoginForm } from "../../components"
|
||||||
import { fetchVolunteerListIfNeed } from "../../store/volunteerList"
|
import { fetchVolunteerListIfNeed } from "../../store/volunteerList"
|
||||||
|
|
||||||
export type Props = RouteComponentProps
|
export type Props = RouteComponentProps
|
||||||
@ -20,7 +21,7 @@ const BoardPage: FC<Props> = (): JSX.Element => {
|
|||||||
</Page>
|
</Page>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
return <div>Besoin d'être identifié</div>
|
return <LoginForm loginNeeded />
|
||||||
}
|
}
|
||||||
|
|
||||||
// Fetch server-side data here
|
// Fetch server-side data here
|
||||||
|
@ -32,6 +32,18 @@ const volunteerLoginSlice = createSlice({
|
|||||||
export default volunteerLoginSlice.reducer
|
export default volunteerLoginSlice.reducer
|
||||||
export const { getRequesting, getSuccess, getFailure } = volunteerLoginSlice.actions
|
export const { getRequesting, getSuccess, getFailure } = volunteerLoginSlice.actions
|
||||||
|
|
||||||
|
export const fetchVolunteerLoginToRoot = elementFetch<
|
||||||
|
VolunteerLogin,
|
||||||
|
Parameters<typeof volunteerLogin>
|
||||||
|
>(volunteerLogin, getRequesting, getSuccess, getFailure, undefined, (login: VolunteerLogin) => {
|
||||||
|
setJWT(login.jwt, login.id, login.roles)
|
||||||
|
// eslint-disable-next-line no-restricted-globals
|
||||||
|
if (location?.pathname) {
|
||||||
|
// eslint-disable-next-line no-restricted-globals
|
||||||
|
location.pathname = "/"
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
export const fetchVolunteerLogin = elementFetch<VolunteerLogin, Parameters<typeof volunteerLogin>>(
|
export const fetchVolunteerLogin = elementFetch<VolunteerLogin, Parameters<typeof volunteerLogin>>(
|
||||||
volunteerLogin,
|
volunteerLogin,
|
||||||
getRequesting,
|
getRequesting,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user