@@ -2,7 +2,7 @@ import React, { useState, useEffect } from "react";
2
2
import Parse from "parse" ;
3
3
import axios from "axios" ;
4
4
import "../styles/AddUser.css" ;
5
- const AddUser = ( props ) => {
5
+ const AddContact = ( props ) => {
6
6
const [ name , setName ] = useState ( "" ) ;
7
7
const [ phone , setPhone ] = useState ( "" ) ;
8
8
const [ email , setEmail ] = useState ( "" ) ;
@@ -50,7 +50,9 @@ const AddUser = (props) => {
50
50
try {
51
51
const contactQuery = new Parse . Object ( "contracts_Contactbook" ) ;
52
52
contactQuery . set ( "Name" , name ) ;
53
- contactQuery . set ( "Phone" , phone ) ;
53
+ if ( phone ) {
54
+ contactQuery . set ( "Phone" , phone ) ;
55
+ }
54
56
contactQuery . set ( "Email" , email ) ;
55
57
contactQuery . set ( "UserRole" , "contracts_Guest" ) ;
56
58
@@ -68,10 +70,10 @@ const AddUser = (props) => {
68
70
_user . set ( "name" , name ) ;
69
71
_user . set ( "username" , email ) ;
70
72
_user . set ( "email" , email ) ;
73
+ _user . set ( "password" , email ) ;
71
74
if ( phone ) {
72
75
_user . set ( "phone" , phone ) ;
73
76
}
74
- _user . set ( "email" , email ) ;
75
77
76
78
const user = await _user . save ( ) ;
77
79
if ( user ) {
@@ -256,14 +258,12 @@ const AddUser = (props) => {
256
258
< div className = "form-section" >
257
259
< label htmlFor = "phone" style = { { fontSize : 13 } } >
258
260
Phone
259
- < span style = { { color : "red" , fontSize : 13 } } > *</ span >
260
261
</ label >
261
262
< input
262
263
type = "text"
263
264
id = "phone"
264
265
value = { phone }
265
266
onChange = { ( e ) => setPhone ( e . target . value ) }
266
- required
267
267
disabled = { addYourself }
268
268
className = "addUserInput"
269
269
/>
@@ -287,4 +287,4 @@ const AddUser = (props) => {
287
287
) ;
288
288
} ;
289
289
290
- export default AddUser ;
290
+ export default AddContact ;
0 commit comments