@@ -30,7 +30,9 @@ export const handleNewUser = (e) => {
30
30
) ;
31
31
return ;
32
32
}
33
- return createNewUser ( email , username , password , phone ) ;
33
+ console . log ( 'sending user data to createNewUser' ) ;
34
+ // return createNewUser(email, username, password, phone);
35
+ createNewUser ( email , username , password , phone ) ;
34
36
} ;
35
37
36
38
export const confirmPassword = ( ) => {
@@ -88,33 +90,27 @@ export const createNewUser = (email, username, password, phone) => {
88
90
phone : phone ,
89
91
} ) ,
90
92
} )
91
- . then ( ( response ) => {
92
- return response . json ( ) ;
93
- } )
94
- . then ( ( data ) => {
95
- if ( Object . prototype . hasOwnProperty . call ( data , 'error' ) ) {
96
- window . alert ( data . error ) ;
97
- } else {
98
- document . getElementById ( 'signupUsername' ) . value = '' ;
99
- document . getElementById ( 'signupPassword' ) . value = '' ;
100
- document . getElementById ( 'signupPasswordConfirmation' ) . value = '' ;
101
- document . getElementById ( 'signupEmail' ) . value = '' ;
102
- document . getElementById ( 'signupPhone' ) . value = '' ;
103
- document . getElementById ( 'password-length-alert' ) . innerHTML = '' ;
104
- document . getElementById ( 'password-confirmation-alert' ) . innerHTML = '' ;
93
+ . then ( ( ) => {
94
+ document . getElementById ( 'signupUsername' ) . value = '' ;
95
+ document . getElementById ( 'signupPassword' ) . value = '' ;
96
+ document . getElementById ( 'signupPasswordConfirmation' ) . value = '' ;
97
+ document . getElementById ( 'signupEmail' ) . value = '' ;
98
+ document . getElementById ( 'signupPhone' ) . value = '' ;
99
+ document . getElementById ( 'password-length-alert' ) . innerHTML = '' ;
100
+ document . getElementById ( 'password-confirmation-alert' ) . innerHTML = '' ;
105
101
106
- window . alert ( `New user has been successfully created. \n\n
102
+ window . alert ( `New user has been successfully created. \n\n
107
103
An email with the user's credentials and login instructions has been sent to ${ email } ` ) ;
108
104
109
- getUpdatedUserList ( ) ;
110
- }
105
+ getUpdatedUserList ( ) ;
111
106
} )
112
107
. catch ( ( err ) => {
113
108
console . log ( err ) ;
114
109
} ) ;
115
110
} ;
116
111
117
112
export const getUpdatedUserList = ( ) => {
113
+ console . log ( 'store username: ' , store . userInfo . username ) ;
118
114
fetch ( 'http://localhost:3000/admin' , {
119
115
method : 'POST' ,
120
116
headers : {
@@ -129,7 +125,10 @@ export const getUpdatedUserList = () => {
129
125
. then ( ( data ) => {
130
126
console . log ( 'this is data from newUserHelper' , data ) ;
131
127
updateUserList ( data ) ;
132
- } ) ;
128
+ } )
129
+ . catch ( ( err ) => {
130
+ console . log ( 'error in getUpdatedUserList: ' , err ) ;
131
+ } )
133
132
} ;
134
133
135
134
export const updateUserList = ( data ) => {
0 commit comments