File tree Expand file tree Collapse file tree 3 files changed +19
-9
lines changed
components/root/users/login/forgottenPassword
spring-backend/src/main/java/backend/hobbiebackend/web Expand file tree Collapse file tree 3 files changed +19
-9
lines changed Original file line number Diff line number Diff line change @@ -2,7 +2,11 @@ import axios from "axios";
2
2
3
3
const UserEmailDataService = async ( email ) => {
4
4
try {
5
- return axios . post ( `http://localhost:8080/notification` , email ) ;
5
+ return axios . post ( `http://localhost:8080/notification` , null , {
6
+ params : {
7
+ email,
8
+ } ,
9
+ } ) ;
6
10
} catch ( err ) {
7
11
let error = "" ;
8
12
if ( err . response ) {
Original file line number Diff line number Diff line change @@ -5,9 +5,11 @@ import { useState } from "react";
5
5
import styles from "../../../../../css/Forms.module.css" ;
6
6
import style from "../../../../../css/Footer.module.css" ;
7
7
import UserEmailDataService from "../../../../../api/users/UserEmailDataService" ;
8
+ import LoadingDotsDark from "../animation/LoadingDotsDark" ;
8
9
9
10
const PasswordChange = ( ) => {
10
11
const [ email , setEmail ] = useState ( "" ) ;
12
+ const [ loading , setLoading ] = useState ( false ) ;
11
13
const [ sent , setSent ] = useState ( false ) ;
12
14
const [ found , setFound ] = useState ( true ) ;
13
15
const [ errors , setErrors ] = useState ( { } ) ;
@@ -29,13 +31,15 @@ const PasswordChange = () => {
29
31
console . log ( errors ) ;
30
32
31
33
if ( Object . keys ( errors ) . length === 0 ) {
34
+ setLoading ( true ) ;
32
35
const res = await UserEmailDataService ( email ) ;
33
36
console . log ( res . status ) ;
34
37
35
38
if ( res . status === 200 ) {
36
39
setSent ( true ) ;
37
40
setFound ( true ) ;
38
41
} else {
42
+ setLoading ( false ) ;
39
43
setFound ( false ) ;
40
44
}
41
45
}
@@ -77,9 +81,13 @@ const PasswordChange = () => {
77
81
</ label >
78
82
</ section >
79
83
</ div >
80
- < button className = { styles . button } onClick = { sentClicked } >
81
- Submit
82
- </ button >
84
+ { loading && < LoadingDotsDark className = { styles . dots } /> }
85
+
86
+ { ! loading && (
87
+ < button className = { styles . button } onClick = { sentClicked } >
88
+ Submit
89
+ </ button >
90
+ ) }
83
91
</ div >
84
92
) }
85
93
{ sent && (
Original file line number Diff line number Diff line change 28
28
29
29
import java .io .UnsupportedEncodingException ;
30
30
import java .net .URLDecoder ;
31
-
31
+ import java . nio . charset . StandardCharsets ;
32
32
33
33
34
34
@ RestController
@@ -110,10 +110,8 @@ public ResponseEntity<?> updateUser(@RequestBody UpdateAppClientDto user) {
110
110
111
111
}
112
112
@ PostMapping ("/notification" )
113
- public ResponseEntity <?> sendNotification (@ RequestBody String e ) throws UnsupportedEncodingException {
114
- String email = URLDecoder .decode (e , "UTF-8" );
115
- email = email .substring (0 , email .length ()-1 );
116
- UserEntity userByEmail = this .userService .findUserByEmail (email );
113
+ public ResponseEntity <?> sendNotification (@ RequestParam ("email" ) String e ) {
114
+ UserEntity userByEmail = this .userService .findUserByEmail (e );
117
115
118
116
if (userByEmail == null ){
119
117
throw new NotFoundException ("User not found" );
You can’t perform that action at this time.
0 commit comments