Skip to content

Commit

Permalink
Format check added
Browse files Browse the repository at this point in the history
  • Loading branch information
RalitsaIlieva committed Oct 10, 2023
1 parent a260081 commit 770cd55
Show file tree
Hide file tree
Showing 7 changed files with 35 additions and 30 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,9 @@ Watch releases of this repository to be notified about future updates:
## Contributors ✨

<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->

[![All Contributors](https://img.shields.io/badge/all_contributors-73-orange.svg?style=flat-square)](#contributors-)

<!-- ALL-CONTRIBUTORS-BADGE:END -->

Please check [contributors guide](https://github.com/podkrepi-bg/frontend/blob/master/CONTRIBUTING.md) for:
Expand Down
2 changes: 1 addition & 1 deletion src/common/form/validation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export const customValidators = {
name: () => ({ key: 'validation:invalid' }),
paymentRef: () => ({ key: 'validation:payment-reference' }),
terms: () => ({ key: 'validation:terms-of-use' }),
gdpr: () => ({key: 'validation:terms-of-service'}),
gdpr: () => ({ key: 'validation:terms-of-service' }),
}

setLocale({
Expand Down
2 changes: 1 addition & 1 deletion src/components/client/one-time-donation/FormikStepper.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { Box, Button, Grid, Step, StepLabel, Stepper, useMediaQuery } from '@mui
import { StepsContext } from './helpers/stepperContext'
import { OneTimeDonation } from 'gql/donations'
import { useSession } from 'next-auth/react'

const PREFIX = 'FormikStepper'

const classes = {
Expand Down
12 changes: 6 additions & 6 deletions src/components/client/one-time-donation/RegisterDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,17 +31,17 @@ export default function RegisterForm() {
confirmPassword: formik.values.confirmPassword as string,
terms: formik.values.terms as boolean,
gdpr: formik.values.gdpr as boolean,
newsletter: formik.values.newsletter as boolean
newsletter: formik.values.newsletter as boolean,
}
const onClick = async () => {
try {
setLoading(true)
// Register in Keycloak

if(values.terms && values.gdpr) {
await register(values)
} else {
throw new Error("Terms or GDPR not accepted")
if (values.terms && values.gdpr) {
await register(values)
} else {
throw new Error('Terms or GDPR not accepted')
}

// Authenticate
Expand All @@ -50,7 +50,7 @@ export default function RegisterForm() {
password: values.password,
redirect: false,
})

if (resp?.error) {
throw new Error(resp.error)
}
Expand Down
2 changes: 1 addition & 1 deletion src/components/client/one-time-donation/Steps.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ const initialValues: OneTimeDonation = {
isRecurring: false,
terms: false,
gdpr: false,
newsletter:false
newsletter: false,
}
interface DonationStepperProps {
onStepChange: () => void
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,26 +18,29 @@ export const validateFirst: yup.SchemaOf<FirstStep> = yup
}),
})

export const validateSecond: yup.SchemaOf<SecondStep> = yup.object().defined().shape({
isAnonymous: yup.boolean().required(),
personsEmail: email.notRequired(),
personsFirstName: name.notRequired(),
personsLastName: name.notRequired(),
personsPhone: phone.notRequired(),
loginEmail: email.notRequired(),
loginPassword: password.notRequired(),
registerEmail: email.notRequired(),
registerFirstName: yup.string().notRequired(),
registerLastName: yup.string().notRequired(),
registerPassword: password.notRequired(),
confirmPassword: yup.string().oneOf(
[yup.ref('registerPassword')],
customValidators.confirmPassword
).notRequired(),
terms: yup.boolean().oneOf([true], customValidators.terms).notRequired(),
gdpr: yup.boolean().oneOf([true], customValidators.gdpr).notRequired(),
newsletter:yup.boolean().notRequired()
})
export const validateSecond: yup.SchemaOf<SecondStep> = yup
.object()
.defined()
.shape({
isAnonymous: yup.boolean().required(),
personsEmail: email.notRequired(),
personsFirstName: name.notRequired(),
personsLastName: name.notRequired(),
personsPhone: phone.notRequired(),
loginEmail: email.notRequired(),
loginPassword: password.notRequired(),
registerEmail: email.notRequired(),
registerFirstName: yup.string().notRequired(),
registerLastName: yup.string().notRequired(),
registerPassword: password.notRequired(),
confirmPassword: yup
.string()
.oneOf([yup.ref('registerPassword')], customValidators.confirmPassword)
.notRequired(),
terms: yup.boolean().oneOf([true], customValidators.terms).notRequired(),
gdpr: yup.boolean().oneOf([true], customValidators.gdpr).notRequired(),
newsletter: yup.boolean().notRequired(),
})

export const validateThird: yup.SchemaOf<ThirdStep> = yup.object().defined().shape({
message: yup.string().notRequired(),
Expand Down
2 changes: 1 addition & 1 deletion src/gql/donations.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ export type OneTimeDonation = {
confirmPassword?: string
terms?: boolean
gdpr?: boolean
newsletter?:boolean
newsletter?: boolean
}

export type DonationStep = {
Expand Down

0 comments on commit 770cd55

Please sign in to comment.