diff --git a/src/components/LogoutButton/LogoutButton.tsx b/src/components/LogoutButton/LogoutButton.tsx index 4ccb9bd..1fdfd19 100644 --- a/src/components/LogoutButton/LogoutButton.tsx +++ b/src/components/LogoutButton/LogoutButton.tsx @@ -1,21 +1,18 @@ import React, { FC, memo, useCallback } from "react" -import { useDispatch, useSelector } from "react-redux" +import { useSelector } from "react-redux" import { unsetJWT } from "../../services/auth" -import { isUserConnected, logoutUser } from "../../store/auth" +import { isUserConnected } from "../../store/auth" import styles from "./styles.module.scss" const LogoutButton: FC = (): JSX.Element | null => { - const dispatch = useDispatch() const connected = useSelector(isUserConnected) - const onClick = useCallback( - (event: React.SyntheticEvent): void => { - event.preventDefault() - unsetJWT() - dispatch(logoutUser()) - }, - [dispatch] - ) + const onClick = useCallback((event: React.SyntheticEvent): void => { + event.preventDefault() + unsetJWT() + // eslint-disable-next-line no-restricted-globals + location?.reload() + }, []) if (!connected) return null diff --git a/src/components/Notifications/index.tsx b/src/components/Notifications/index.tsx index 35fee67..9524dc0 100644 --- a/src/components/Notifications/index.tsx +++ b/src/components/Notifications/index.tsx @@ -7,7 +7,7 @@ import styles from "./styles.module.scss" import { selectUserJwtToken } from "../../store/auth" import { VolunteerNotifs } from "../../services/volunteers" import LogoutButton from "../LogoutButton/LogoutButton" -import { TeamWishesForm } from ".." +// import { TeamWishesForm } from ".." import { fetchFor as fetchForTeamWishesForm } from "../VolunteerBoard/TeamWishesForm/TeamWishesForm" interface Props { @@ -144,25 +144,25 @@ const Notifications = ({ volunteerNotifs }: Props): JSX.Element | null => { ) } - const onSubmit3 = useCallback((): void => { - dispatch( - fetchVolunteerNotifsSet(jwtToken, 0, { - hiddenNotifs: [...(volunteerNotifs?.hiddenNotifs || []), 3], - }) - ) - }, [dispatch, jwtToken, volunteerNotifs]) + // const onSubmit3 = useCallback((): void => { + // dispatch( + // fetchVolunteerNotifsSet(jwtToken, 0, { + // hiddenNotifs: [...(volunteerNotifs?.hiddenNotifs || []), 3], + // }) + // ) + // }, [dispatch, jwtToken, volunteerNotifs]) - if (!_.includes(hidden, 3)) { - notifs.push( -
-
-
- -
-
-
- ) - } + // if (!_.includes(hidden, 3)) { + // notifs.push( + //
+ //
+ //
+ // + //
+ //
+ //
+ // ) + // } /* DISCORD Discord nous donne à tous la parole via nos téléphone ou navigateurs, pour organiser le meilleur des festivals ! diff --git a/src/pages/Announcements/Announcements.tsx b/src/pages/Announcements/Announcements.tsx index 2785f65..6db2d3c 100644 --- a/src/pages/Announcements/Announcements.tsx +++ b/src/pages/Announcements/Announcements.tsx @@ -48,13 +48,13 @@ const AnnouncementsPage: FC = (): JSX.Element => { } return (
-
+
-
+
S'informer sur le bénévolat
diff --git a/src/store/auth.ts b/src/store/auth.ts index 3e3b12c..e6d3535 100644 --- a/src/store/auth.ts +++ b/src/store/auth.ts @@ -22,6 +22,7 @@ export const auth = createSlice({ state.jwt = action.payload.jwt }, logoutUser: (state) => { + // Unused, just reload page :/ state.id = 0 state.jwt = "" }, diff --git a/src/store/volunteerLogin.ts b/src/store/volunteerLogin.ts index f2d8365..27dbf62 100644 --- a/src/store/volunteerLogin.ts +++ b/src/store/volunteerLogin.ts @@ -3,9 +3,6 @@ import { PayloadAction, createSlice } from "@reduxjs/toolkit" import { StateRequest, elementFetch } from "./utils" import { VolunteerLogin } from "../services/volunteers" import { setJWT } from "../services/auth" -import { AppDispatch } from "." -import { setCurrentUser } from "./auth" -import { fetchVolunteerNotifsSet } from "./volunteerNotifsSet" import { volunteerLogin } from "../services/volunteersAccessors" type StateVolunteer = { entity?: VolunteerLogin } & StateRequest @@ -41,9 +38,9 @@ export const fetchVolunteerLogin = elementFetch { + (login: VolunteerLogin) => { setJWT(login.jwt, login.id) - dispatch(setCurrentUser(login)) - dispatch(fetchVolunteerNotifsSet(login.jwt, login.id, {})) + // eslint-disable-next-line no-restricted-globals + location?.reload() } )