@@ -4,6 +4,7 @@ import React, { useEffect, useState } from "react";
4
4
import { Link , useNavigate } from "react-router-dom" ;
5
5
import appConfig from "../../config/appConfig" ;
6
6
import withReactContent from "sweetalert2-react-content" ;
7
+ import InputValidation from "../Layout/Components/InputValidation" ;
7
8
8
9
export default function Register ( ) {
9
10
const navigate = useNavigate ( ) ;
@@ -132,83 +133,38 @@ export default function Register() {
132
133
</ div >
133
134
< div className = "card-body" >
134
135
< form onSubmit = { registerHandler } >
135
- < div className = "form-group" >
136
- < label htmlFor = "name" > Full name</ label >
137
- < input
138
- type = "text"
139
- name = "name"
140
- id = "name"
141
- className = { `form-control ${
142
- formErrors . name ? "is-invalid" : ""
143
- } `}
144
- value = { formData . name || "" }
145
- onChange = { handleInputChange }
146
- />
147
- { formErrors . name && (
148
- < div className = "invalid-feedback" >
149
- { formErrors . name }
150
- </ div >
151
- ) }
152
- </ div >
153
-
154
- < div className = "form-group" >
155
- < label htmlFor = "email" > Email</ label >
156
- < input
157
- type = "email"
158
- name = "email"
159
- id = "email"
160
- className = { `form-control ${
161
- formErrors . email ? "is-invalid" : ""
162
- } `}
163
- value = { formData . email || "" }
164
- onChange = { handleInputChange }
165
- />
166
- { formErrors . email && (
167
- < div className = "invalid-feedback" >
168
- { formErrors . email }
169
- </ div >
170
- ) }
171
- </ div >
172
- < div className = "form-group" >
173
- < label htmlFor = "password" > Password</ label >
174
- < input
175
- type = "password"
176
- name = "password"
177
- id = "password"
178
- className = { `form-control ${
179
- formErrors . password ? "is-invalid" : ""
180
- } `}
181
- value = { formData . password || "" }
182
- onChange = { handleInputChange }
183
- />
184
- { formErrors . password && (
185
- < div className = "invalid-feedback" >
186
- { formErrors . password }
187
- </ div >
188
- ) }
189
- </ div >
190
- < div className = "form-group" >
191
- < label htmlFor = "password_confirmation" >
192
- Confirm Password
193
- </ label >
194
- < input
195
- type = "password"
196
- name = "password_confirmation"
197
- id = "password_confirmation"
198
- className = { `form-control ${
199
- formErrors . password_confirmation
200
- ? "is-invalid"
201
- : ""
202
- } `}
203
- value = { formData . password_confirmation || "" }
204
- onChange = { handleInputChange }
205
- />
206
- { formErrors . password_confirmation && (
207
- < div className = "invalid-feedback" >
208
- { formErrors . password_confirmation }
209
- </ div >
210
- ) }
211
- </ div >
136
+ < InputValidation
137
+ label = "Full name"
138
+ name = "name"
139
+ type = "text"
140
+ value = { formData . name }
141
+ onChange = { handleInputChange }
142
+ error = { formErrors . name }
143
+ />
144
+ < InputValidation
145
+ label = "Email"
146
+ name = "email"
147
+ type = "email"
148
+ value = { formData . email }
149
+ onChange = { handleInputChange }
150
+ error = { formErrors . email }
151
+ />
152
+ < InputValidation
153
+ label = "Password"
154
+ name = "password"
155
+ type = "password"
156
+ value = { formData . password }
157
+ onChange = { handleInputChange }
158
+ error = { formErrors . password }
159
+ />
160
+ < InputValidation
161
+ label = "Confirmation Password"
162
+ name = "password_confirmation"
163
+ type = "password"
164
+ value = { formData . password_confirmation }
165
+ onChange = { handleInputChange }
166
+ error = { formErrors . password_confirmation }
167
+ />
212
168
213
169
< div className = "form-group" >
214
170
< label htmlFor = "role" > Role user</ label >
0 commit comments