File tree Expand file tree Collapse file tree 2 files changed +14
-7
lines changed Expand file tree Collapse file tree 2 files changed +14
-7
lines changed Original file line number Diff line number Diff line change @@ -8,17 +8,24 @@ const ScanForm = ({ addScan }) => {
8
8
9
9
const handleSubmit = ev => {
10
10
const form = ev . currentTarget ;
11
- if ( form . checkValidity ( ) === true ) {
12
- addScan ( repoName ) . catch ( err => {
13
- setError ( err . message ) ;
14
- } ) ;
15
- } else {
16
- ev . preventDefault ( ) ;
11
+ ev . preventDefault ( ) ;
12
+
13
+ if ( form . checkValidity ( ) === false ) {
17
14
ev . stopPropagation ( ) ;
15
+ } else {
16
+ addScan ( repoName )
17
+ . catch ( err => {
18
+ setError ( err . message ) ;
19
+ } )
20
+ . then ( ( ) => {
21
+ setRepoName ( '' ) ;
22
+ setValidated ( false ) ;
23
+ } ) ;
18
24
}
19
25
20
26
setValidated ( true ) ;
21
27
} ;
28
+
22
29
return (
23
30
< >
24
31
< h2 > Submit a Scan Result</ h2 >
Original file line number Diff line number Diff line change @@ -12,7 +12,7 @@ const useScan = () => {
12
12
response = await axios . post ( url , { repoName } ) ;
13
13
setScans ( [ ...scans , response . data ] ) ;
14
14
} catch ( e ) {
15
- throw new Error ( 'You must enter a valid name !' ) ;
15
+ throw new Error ( 'The name you entered does not contain authorized characters !' ) ;
16
16
}
17
17
} ;
18
18
You can’t perform that action at this time.
0 commit comments