Add register form, missing proper feedback on error or success

This commit is contained in:
pikiou
2022-03-17 00:22:34 +01:00
parent cef7c5f7b0
commit 7fc3ec08ba
26 changed files with 350 additions and 260 deletions

View File

@@ -1,4 +1,4 @@
export class PreVolunteer {
export class Postulant {
id = 0
firstname = ""
@@ -9,25 +9,25 @@ export class PreVolunteer {
mobile = ""
alreadyVolunteer = false
potential = false
comment = ""
}
export const translationPreVolunteer: { [k in keyof PreVolunteer]: string } = {
export const translationPostulant: { [k in keyof Postulant]: string } = {
id: "id",
firstname: "prenom",
lastname: "nom",
email: "email",
mobile: "telephone",
alreadyVolunteer: "dejaBenevole",
potential: "potentiel",
comment: "commentaire",
}
export const elementName = "PreVolunteer"
export const elementName = "Postulant"
export const emailRegexp =
/^(([^<>()[\].,;:\s@"]+(\.[^<>()[\].,;:\s@"]+)*)|(".+"))@(([^<>()[\].,;:\s@"]+\.)+[^<>()[\].,;:\s@"]{2,})$/i
export const passwordMinLength = 4
export type PreVolunteerWithoutId = Omit<PreVolunteer, "id">
export type PostulantWithoutId = Omit<Postulant, "id">

View File

@@ -0,0 +1,9 @@
import ServiceAccessors from "./accessors"
import { elementName, Postulant, PostulantWithoutId } from "./postulants"
const serviceAccessors = new ServiceAccessors<PostulantWithoutId, Postulant>(elementName)
export const postulantListGet = serviceAccessors.listGet()
export const postulantGet = serviceAccessors.get()
export const postulantAdd = serviceAccessors.add()
export const postulantSet = serviceAccessors.set()

View File

@@ -1,10 +0,0 @@
import ServiceAccessors from "./accessors"
import { elementName, PreVolunteer, PreVolunteerWithoutId } from "./preVolunteers"
const serviceAccessors = new ServiceAccessors<PreVolunteerWithoutId, PreVolunteer>(elementName)
export const preVolunteerListGet = serviceAccessors.listGet()
export const preVolunteerGet = serviceAccessors.get()
export const preVolunteerAdd = serviceAccessors.add()
export const preVolunteerSet = serviceAccessors.set()
export const preVolunteerCountGet = serviceAccessors.countGet()

View File

@@ -1,4 +1,5 @@
export class Volunteer {
/* eslint-disable max-classes-per-file */
export class Volunteer implements VolunteerPartial {
id = 0
lastname = ""
@@ -9,7 +10,7 @@ export class Volunteer {
mobile = ""
photo = ""
photo = "anonyme.png"
adult = 1
@@ -27,7 +28,7 @@ export class Volunteer {
tshirtSize = ""
food = ""
food = "Aucune"
teamWishes: number[] = []
@@ -72,6 +73,22 @@ export const translationVolunteer: { [k in keyof Volunteer]: string } = {
acceptsNotifs: "accepteLesNotifs",
}
export class VolunteerPartial {
lastname = ""
firstname = ""
email = ""
mobile = ""
}
export class VolunteerPartialAddReturn {
id = 0
password = ""
}
export const elementName = "Volunteer"
export const volunteerExample: Volunteer = {

View File

@@ -13,7 +13,7 @@ const serviceAccessors = new ServiceAccessors<VolunteerWithoutId, Volunteer>(ele
export const volunteerListGet = serviceAccessors.listGet()
export const volunteerGet = serviceAccessors.get()
export const volunteerAdd = serviceAccessors.add()
export const volunteerPartialAdd = serviceAccessors.customPost<[Partial<Volunteer>]>("PartialAdd")
export const volunteerSet = serviceAccessors.set()
export const volunteerLogin =