Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
dashboard
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
red-giant
dashboard
Commits
d7fe0406
Verified
Commit
d7fe0406
authored
3 years ago
by
Defendi Alberto
Browse files
Options
Downloads
Patches
Plain Diff
Include data asked by backend
parent
75b8c5e5
No related branches found
No related tags found
1 merge request
!56
Refined auth flow and new website pages.
Pipeline
#11978
passed
3 years ago
Stage: build
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/components/AuthUser/SignUpForm/SignUpForm.tsx
+57
-23
57 additions, 23 deletions
src/components/AuthUser/SignUpForm/SignUpForm.tsx
with
57 additions
and
23 deletions
src/components/AuthUser/SignUpForm/SignUpForm.tsx
+
57
−
23
View file @
d7fe0406
...
...
@@ -4,25 +4,39 @@ import { Button } from '@material-ui/core';
import
{
InputField
}
from
'
components/AuthUser/InputField/InputField
'
;
import
{
useStyles
}
from
'
components/AuthUser/SignUpForm/useStyles
'
;
import
axios
from
'
axios
'
;
// TODO: Data validation
// TODO: Replace notes with big input field
export
const
SignUpForm
:
FC
=
()
=>
{
type
FormData
=
{
firstName
:
string
;
lastName
:
string
;
user
:
{
username
:
string
;
password
:
string
;
firstName
:
string
;
lastName
:
string
;
email
:
string
;
};
phoneNumber
:
number
;
homeAddress
:
string
;
cardNumber
:
number
;
email
:
string
;
password
:
string
;
homeAddress
:
{
address
:
string
;
};
memberCardIssuer
:
{
name
:
string
;
};
memberCardNumber
:
number
;
notes
:
string
;
};
const
{
control
,
errors
,
handleSubmit
}
=
useForm
<
FormData
>
();
const
onSubmit
:
SubmitHandler
<
FormData
>
=
(
values
:
FormData
)
=>
{
axios
.
post
(
'
/api/web/
'
,
'
/api/web/
seniors/
'
,
{
values
,
user
:
values
.
user
,
phone_number
:
values
.
phoneNumber
,
home_address
:
values
.
homeAddress
.
address
,
member_card_issuer
:
values
.
memberCardIssuer
,
notes
:
values
.
notes
,
},
{
headers
:
{
...
...
@@ -51,7 +65,7 @@ export const SignUpForm: FC = () => {
},
}
}
label
=
"First name"
error
=
{
!!
errors
.
firstName
}
error
=
{
!!
errors
.
user
?.
firstName
}
errorMessage
=
"Insert firstName"
/>
...
...
@@ -66,7 +80,7 @@ export const SignUpForm: FC = () => {
},
}
}
label
=
"Last name"
error
=
{
!!
errors
.
lastName
}
error
=
{
!!
errors
.
user
?.
lastName
}
errorMessage
=
"Insert lastName"
/>
...
...
@@ -74,7 +88,6 @@ export const SignUpForm: FC = () => {
name
=
"phoneNumber"
control
=
{
control
}
rules
=
{
{
validate
:
(
value
:
string
)
=>
/^
[/
d
]
$/
.
test
(
value
),
required
:
{
value
:
true
,
message
:
'
phoneNumber is not valid
'
,
...
...
@@ -84,35 +97,56 @@ export const SignUpForm: FC = () => {
error
=
{
!!
errors
.
phoneNumber
}
errorMessage
=
"Insert phoneNumber"
/>
<
InputField
name
=
"memberCardIssuer"
control
=
{
control
}
rules
=
{
{
validate
:
(
value
:
string
)
=>
/^
[
A-Za-z
]
$/
.
test
(
value
),
required
:
{
value
:
true
,
message
:
'
memberCardIssuer is not valid
'
,
},
}
}
label
=
"Member card issuer"
error
=
{
!!
errors
.
memberCardIssuer
?.
name
}
errorMessage
=
"Insert memberCardIssuer"
/>
<
InputField
name
=
"
c
ardNumber"
name
=
"
memberC
ardNumber"
control
=
{
control
}
rules
=
{
{
validate
:
(
value
:
string
)
=>
/^
[/
d
]
$/
.
test
(
value
),
required
:
{
value
:
true
,
message
:
'
c
ardNumber is not valid
'
,
message
:
'
memberC
ardNumber is not valid
'
,
},
}
}
label
=
"Card number"
error
=
{
!!
errors
.
c
ardNumber
}
errorMessage
=
"Insert
c
ardNumber"
error
=
{
!!
errors
.
memberC
ardNumber
}
errorMessage
=
"Insert
memberC
ardNumber"
/>
<
InputField
name
=
"
homeA
ddress"
name
=
"
a
ddress"
control
=
{
control
}
rules
=
{
{
validate
:
(
value
:
string
)
=>
/^
[
A-Za-z
]
$/
.
test
(
value
),
required
:
{
value
:
true
,
message
:
'
homeA
ddress is not valid
'
,
message
:
'
a
ddress is not valid
'
,
},
}
}
label
=
"Home address"
error
=
{
!!
errors
.
homeAddress
}
errorMessage
=
"Insert homeAddress"
error
=
{
!!
errors
.
homeAddress
?.
address
}
errorMessage
=
"Insert address"
/>
<
InputField
name
=
"notes"
control
=
{
control
}
label
=
"Notes"
error
=
{
!!
errors
.
notes
}
errorMessage
=
"Insert valid password"
/>
<
InputField
...
...
@@ -127,7 +161,7 @@ export const SignUpForm: FC = () => {
},
}
}
label
=
"Email"
error
=
{
!!
errors
.
email
}
error
=
{
!!
errors
.
user
?.
email
}
errorMessage
=
"Insert email"
/>
...
...
@@ -143,7 +177,7 @@ export const SignUpForm: FC = () => {
},
}
}
label
=
"Password"
error
=
{
!!
errors
.
password
}
error
=
{
!!
errors
.
user
?.
password
}
errorMessage
=
"Insert valid password"
/>
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment