Skip to content

Commit

Permalink
auth/register: Change register request to match latest changes in bac…
Browse files Browse the repository at this point in the history
…kend
  • Loading branch information
sashko9807 committed Oct 25, 2023
1 parent 76fa2b1 commit 86b1f65
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
8 changes: 8 additions & 0 deletions src/components/client/auth/register/RegisterForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import EmailField from 'components/common/form/EmailField'
import AcceptNewsLetterField from 'components/common/form/AcceptNewsletterField'

export type RegisterFormData = {
type: ProfileType
firstName: string
lastName: string
email: string
Expand All @@ -29,10 +30,16 @@ export type RegisterFormData = {
newsletter?: boolean
}

enum ProfileType {
INDIVIDUAL = 'individual',
CORPORATE = 'corporate',
}

const validationSchema: yup.SchemaOf<RegisterFormData> = yup
.object()
.defined()
.shape({
type: yup.mixed<ProfileType>().required().oneOf(Object.values(ProfileType)),
firstName: name.required(),
lastName: name.required(),
email: email.required(),
Expand All @@ -44,6 +51,7 @@ const validationSchema: yup.SchemaOf<RegisterFormData> = yup
})

const defaults: RegisterFormData = {
type: ProfileType.INDIVIDUAL,
firstName: '',
lastName: '',
email: '',
Expand Down
2 changes: 1 addition & 1 deletion src/service/apiEndpoints.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ type Endpoint = {
export const endpoints = {
auth: {
login: <Endpoint>{ url: '/login', method: 'POST' },
register: <Endpoint>{ url: '/register/individual', method: 'POST' },
register: <Endpoint>{ url: '/register', method: 'POST' },
refresh: <Endpoint>{ url: '/refresh', method: 'POST' },
providerLogin: <Endpoint>{ url: '/provider-login', method: 'POST' },
},
Expand Down

0 comments on commit 86b1f65

Please sign in to comment.