Add email and error message when duplicate email at registration

This commit is contained in:
pikiou
2022-04-12 17:31:53 +02:00
parent dc4fdda658
commit ebefcb247c
9 changed files with 123 additions and 79 deletions

View File

@@ -30,6 +30,9 @@ export default class ServiceAccessors<
...axiosConfig,
params: { id },
})
if (data.error) {
throw Error(data.error)
}
return { data }
} catch (error) {
return { error: error as Error }
@@ -51,6 +54,9 @@ export default class ServiceAccessors<
`${config.API_URL}/${this.elementName}ListGet`,
axiosConfig
)
if (data.error) {
throw Error(data.error)
}
return { data }
} catch (error) {
return { error: error as Error }
@@ -100,6 +106,9 @@ export default class ServiceAccessors<
volunteerWithoutId,
axiosConfig
)
if (data.error) {
throw Error(data.error)
}
return { data }
} catch (error) {
return { error: error as Error }
@@ -122,6 +131,9 @@ export default class ServiceAccessors<
volunteer,
axiosConfig
)
if (data.error) {
throw Error(data.error)
}
return { data }
} catch (error) {
return { error: error as Error }
@@ -143,6 +155,9 @@ export default class ServiceAccessors<
`${config.API_URL}/${this.elementName}CountGet`,
axiosConfig
)
if (data.error) {
throw Error(data.error)
}
return { data }
} catch (error) {
return { error: error as Error }

View File

@@ -24,7 +24,7 @@ export class Volunteer implements VolunteerPartial {
dayWishesComment = ""
tshirtCount = ""
tshirtCount = 0
tshirtSize = ""
@@ -92,12 +92,6 @@ export class VolunteerPartial {
mobile = ""
}
export class VolunteerPartialAddReturn {
id = 0
password = ""
}
export const elementName = "Volunteer"
export const volunteerExample: Volunteer = {
@@ -113,7 +107,7 @@ export const volunteerExample: Volunteer = {
discordId: "",
dayWishes: [],
dayWishesComment: "",
tshirtCount: "1",
tshirtCount: 1,
tshirtSize: "Femme M",
food: "Végétarien",
teamWishes: [],