mirror of
https://github.com/Paris-est-Ludique/intranet.git
synced 2025-06-08 08:34:20 +02:00
Fix names still in french
This commit is contained in:
parent
c64bf376f8
commit
6bd3a9595f
@ -4,7 +4,7 @@ import { toast } from "react-toastify"
|
||||
import _ from "lodash"
|
||||
import styles from "./styles.module.scss"
|
||||
|
||||
import { fetchPreMemberAdd } from "../../store/preVolunteerAdd"
|
||||
import { fetchPreVolunteerAdd } from "../../store/preVolunteerAdd"
|
||||
import { AppDispatch, AppState } from "../../store"
|
||||
|
||||
interface Props {
|
||||
@ -36,7 +36,7 @@ const RegisterForm = ({ dispatch }: Props): JSX.Element => {
|
||||
const onSubmit = () => {
|
||||
if (firstname && lastname && email && mobile && !sending) {
|
||||
dispatch(
|
||||
fetchPreMemberAdd({
|
||||
fetchPreVolunteerAdd({
|
||||
firstname,
|
||||
lastname,
|
||||
email,
|
||||
@ -60,13 +60,13 @@ const RegisterForm = ({ dispatch }: Props): JSX.Element => {
|
||||
}
|
||||
}
|
||||
|
||||
const { error, entities: preMember } = useSelector(
|
||||
(state: AppState) => state.preMemberAdd,
|
||||
const { error, entities: preVolunteer } = useSelector(
|
||||
(state: AppState) => state.preVolunteerAdd,
|
||||
shallowEqual
|
||||
)
|
||||
|
||||
let sendSuccess
|
||||
if (!_.isEmpty(preMember)) {
|
||||
if (!_.isEmpty(preVolunteer)) {
|
||||
if (sending) {
|
||||
setSending(false)
|
||||
}
|
||||
@ -74,7 +74,7 @@ const RegisterForm = ({ dispatch }: Props): JSX.Element => {
|
||||
}
|
||||
|
||||
let sendError
|
||||
if (error && _.isEmpty(preMember)) {
|
||||
if (error && _.isEmpty(preVolunteer)) {
|
||||
if (sending) {
|
||||
setSending(false)
|
||||
}
|
||||
|
@ -1,16 +1,20 @@
|
||||
import getExpressAccessors from "./expressAccessors"
|
||||
import { sheetNames } from "./accessors"
|
||||
import { PreMember, PreMemberWithoutId, translationPreMember } from "../../services/preVolunteers"
|
||||
import {
|
||||
PreVolunteer,
|
||||
PreVolunteerWithoutId,
|
||||
translationPreVolunteer,
|
||||
} from "../../services/preVolunteers"
|
||||
|
||||
const { listGetRequest, getRequest, setRequest, addRequest } = getExpressAccessors<
|
||||
PreMemberWithoutId,
|
||||
PreMember
|
||||
>(sheetNames.PreVolunteers, new PreMember(), translationPreMember)
|
||||
PreVolunteerWithoutId,
|
||||
PreVolunteer
|
||||
>(sheetNames.PreVolunteers, new PreVolunteer(), translationPreVolunteer)
|
||||
|
||||
export const preMemberListGet = listGetRequest()
|
||||
export const preVolunteerListGet = listGetRequest()
|
||||
|
||||
export const preMemberGet = getRequest()
|
||||
export const preVolunteerGet = getRequest()
|
||||
|
||||
export const preMemberAdd = addRequest()
|
||||
export const preVolunteerAdd = addRequest()
|
||||
|
||||
export const preMemberSet = setRequest()
|
||||
export const preVolunteerSet = setRequest()
|
||||
|
@ -1,11 +1,11 @@
|
||||
import getExpressAccessors from "./expressAccessors"
|
||||
import { sheetNames } from "./accessors"
|
||||
import { Volunteer, VolunteerWithoutId, translationMember } from "../../services/volunteers"
|
||||
import { Volunteer, VolunteerWithoutId, translationVolunteer } from "../../services/volunteers"
|
||||
|
||||
const { listGetRequest, getRequest, setRequest, addRequest } = getExpressAccessors<
|
||||
VolunteerWithoutId,
|
||||
Volunteer
|
||||
>(sheetNames.Volunteers, new Volunteer(), translationMember)
|
||||
>(sheetNames.Volunteers, new Volunteer(), translationVolunteer)
|
||||
|
||||
export const volunteerListGet = listGetRequest()
|
||||
|
||||
|
@ -18,7 +18,7 @@ import certbotRouter from "../routes/certbot"
|
||||
import { secure } from "./secure"
|
||||
import { javGameListGet } from "./gsheets/javGames"
|
||||
import { wishListGet, wishAdd } from "./gsheets/wishes"
|
||||
import { preMemberAdd } from "./gsheets/preVolunteers"
|
||||
import { preVolunteerAdd } from "./gsheets/preVolunteers"
|
||||
import { volunteerGet, volunteerSet } from "./gsheets/volunteers"
|
||||
import loginHandler from "./userManagement/login"
|
||||
import config from "../config"
|
||||
@ -57,7 +57,7 @@ app.post("/api/user/login", loginHandler)
|
||||
app.get("/JavGameListGet", javGameListGet)
|
||||
app.get("/WishListGet", wishListGet)
|
||||
app.post("/WishAdd", wishAdd)
|
||||
app.post("/PreMemberAdd", preMemberAdd)
|
||||
app.post("/PreVolunteerAdd", preVolunteerAdd)
|
||||
|
||||
// Secured APIs
|
||||
app.get("/VolunteerGet", secure as RequestHandler, volunteerGet)
|
||||
|
@ -2,10 +2,10 @@ import { Request, Response, NextFunction } from "express"
|
||||
import bcrypt from "bcrypt"
|
||||
import {
|
||||
Volunteer,
|
||||
MemberLogin,
|
||||
VolunteerLogin,
|
||||
emailRegexp,
|
||||
passwordMinLength,
|
||||
translationMember,
|
||||
translationVolunteer,
|
||||
} from "../../services/volunteers"
|
||||
import { getAccessors, sheetNames } from "../gsheets/accessors"
|
||||
import { getJwt } from "../secure"
|
||||
@ -30,8 +30,8 @@ export default async function loginHandler(
|
||||
}
|
||||
}
|
||||
|
||||
export async function login(rawEmail: string, rawPassword: string): Promise<MemberLogin> {
|
||||
const { listGet } = getAccessors(sheetNames.Volunteers, new Volunteer(), translationMember)
|
||||
export async function login(rawEmail: string, rawPassword: string): Promise<VolunteerLogin> {
|
||||
const { listGet } = getAccessors(sheetNames.Volunteers, new Volunteer(), translationVolunteer)
|
||||
|
||||
const email = rawEmail.replace(/^\s*/, "").replace(/\s*$/, "")
|
||||
if (!emailRegexp.test(email)) {
|
||||
|
@ -1,6 +1,6 @@
|
||||
import getServiceAccessors from "./accessors"
|
||||
|
||||
export class PreMember {
|
||||
export class PreVolunteer {
|
||||
id = 0
|
||||
|
||||
firstname = ""
|
||||
@ -16,7 +16,7 @@ export class PreMember {
|
||||
comment = ""
|
||||
}
|
||||
|
||||
export const translationPreMember: { [k in keyof PreMember]: string } = {
|
||||
export const translationPreVolunteer: { [k in keyof PreVolunteer]: string } = {
|
||||
id: "id",
|
||||
firstname: "prenom",
|
||||
lastname: "nom",
|
||||
@ -26,16 +26,16 @@ export const translationPreMember: { [k in keyof PreMember]: string } = {
|
||||
comment: "commentaire",
|
||||
}
|
||||
|
||||
const elementName = "PreMember"
|
||||
const elementName = "PreVolunteer"
|
||||
|
||||
export type PreMemberWithoutId = Omit<PreMember, "id">
|
||||
export type PreVolunteerWithoutId = Omit<PreVolunteer, "id">
|
||||
|
||||
const { listGet, get, set, add } = getServiceAccessors<PreMemberWithoutId, PreMember>(
|
||||
const { listGet, get, set, add } = getServiceAccessors<PreVolunteerWithoutId, PreVolunteer>(
|
||||
elementName,
|
||||
translationPreMember
|
||||
translationPreVolunteer
|
||||
)
|
||||
|
||||
export const preMemberListGet = listGet()
|
||||
export const preMemberGet = get()
|
||||
export const preMemberAdd = add()
|
||||
export const preMemberSet = set()
|
||||
export const preVolunteerListGet = listGet()
|
||||
export const preVolunteerGet = get()
|
||||
export const preVolunteerAdd = add()
|
||||
export const preVolunteerSet = set()
|
||||
|
@ -28,7 +28,7 @@ export class Volunteer {
|
||||
password = ""
|
||||
}
|
||||
|
||||
export const translationMember: { [k in keyof Volunteer]: string } = {
|
||||
export const translationVolunteer: { [k in keyof Volunteer]: string } = {
|
||||
id: "id",
|
||||
lastname: "nom",
|
||||
firstname: "prenom",
|
||||
@ -50,7 +50,7 @@ export const emailRegexp =
|
||||
/^(([^<>()[\].,;:\s@"]+(\.[^<>()[\].,;:\s@"]+)*)|(".+"))@(([^<>()[\].,;:\s@"]+\.)+[^<>()[\].,;:\s@"]{2,})$/i
|
||||
export const passwordMinLength = 4
|
||||
|
||||
export interface MemberLogin {
|
||||
export interface VolunteerLogin {
|
||||
volunteer?: {
|
||||
firstname: string
|
||||
}
|
||||
@ -62,7 +62,7 @@ export type VolunteerWithoutId = Omit<Volunteer, "id">
|
||||
|
||||
const { listGet, get, set, add } = getServiceAccessors<VolunteerWithoutId, Volunteer>(
|
||||
elementName,
|
||||
translationMember
|
||||
translationVolunteer
|
||||
)
|
||||
|
||||
export const volunteerListGet = listGet()
|
||||
|
@ -1,22 +1,22 @@
|
||||
import { PayloadAction, createSlice, createEntityAdapter } from "@reduxjs/toolkit"
|
||||
|
||||
import { StateRequest, elementAddFetch } from "./utils"
|
||||
import { PreMember, preMemberAdd } from "../services/preVolunteers"
|
||||
import { PreVolunteer, preVolunteerAdd } from "../services/preVolunteers"
|
||||
|
||||
const preMemberAdapter = createEntityAdapter<PreMember>()
|
||||
const preVolunteerAdapter = createEntityAdapter<PreVolunteer>()
|
||||
|
||||
const preMemberAddSlice = createSlice({
|
||||
name: "addPreMember",
|
||||
initialState: preMemberAdapter.getInitialState({
|
||||
const preVolunteerAddSlice = createSlice({
|
||||
name: "addPreVolunteer",
|
||||
initialState: preVolunteerAdapter.getInitialState({
|
||||
readyStatus: "idle",
|
||||
} as StateRequest),
|
||||
reducers: {
|
||||
getRequesting: (state) => {
|
||||
state.readyStatus = "request"
|
||||
},
|
||||
getSuccess: (state, { payload }: PayloadAction<PreMember>) => {
|
||||
getSuccess: (state, { payload }: PayloadAction<PreVolunteer>) => {
|
||||
state.readyStatus = "success"
|
||||
preMemberAdapter.addOne(state, payload)
|
||||
preVolunteerAdapter.addOne(state, payload)
|
||||
},
|
||||
getFailure: (state, { payload }: PayloadAction<string>) => {
|
||||
state.readyStatus = "failure"
|
||||
@ -25,11 +25,11 @@ const preMemberAddSlice = createSlice({
|
||||
},
|
||||
})
|
||||
|
||||
export default preMemberAddSlice.reducer
|
||||
export const { getRequesting, getSuccess, getFailure } = preMemberAddSlice.actions
|
||||
export default preVolunteerAddSlice.reducer
|
||||
export const { getRequesting, getSuccess, getFailure } = preVolunteerAddSlice.actions
|
||||
|
||||
export const fetchPreMemberAdd = elementAddFetch(
|
||||
preMemberAdd,
|
||||
export const fetchPreVolunteerAdd = elementAddFetch(
|
||||
preVolunteerAdd,
|
||||
getRequesting,
|
||||
getSuccess,
|
||||
getFailure,
|
||||
|
@ -8,7 +8,7 @@ import volunteer from "./volunteer"
|
||||
import volunteerAdd from "./volunteerAdd"
|
||||
import volunteerList from "./volunteerList"
|
||||
import volunteerSet from "./volunteerSet"
|
||||
import preMemberAdd from "./preVolunteerAdd"
|
||||
import preVolunteerAdd from "./preVolunteerAdd"
|
||||
|
||||
// Use inferred return type for making correctly Redux types
|
||||
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
|
||||
@ -20,7 +20,7 @@ export default (history: History) => ({
|
||||
volunteerAdd,
|
||||
volunteerList,
|
||||
volunteerSet,
|
||||
preMemberAdd,
|
||||
preVolunteerAdd,
|
||||
router: connectRouter(history) as any,
|
||||
// Register more reducers...
|
||||
})
|
||||
|
Loading…
x
Reference in New Issue
Block a user