File tree Expand file tree Collapse file tree 1 file changed +23
-3
lines changed Expand file tree Collapse file tree 1 file changed +23
-3
lines changed Original file line number Diff line number Diff line change @@ -16,7 +16,14 @@ function UploadAlt() {
16
16
// console.log(file[0]);
17
17
}
18
18
19
-
19
+ const showModal = ( ) => {
20
+ setIsModalVisible ( true ) ;
21
+ } ;
22
+
23
+ const handleCancel = ( ) => {
24
+ setIsModalVisible ( false ) ;
25
+ } ;
26
+
20
27
const handleSubmit = ( e ) => {
21
28
const fr = new FileReader ( ) ;
22
29
fr . onload = function ( e ) {
@@ -25,6 +32,7 @@ function UploadAlt() {
25
32
setfileDataContent ( text ) ;
26
33
console . log ( fileDataContent ) ;
27
34
} ;
35
+
28
36
fr . readAsText ( fileData ) ;
29
37
axios ( {
30
38
method : "post" ,
@@ -55,9 +63,21 @@ function UploadAlt() {
55
63
< Button type = "primary" onClick = { showModal } style = { { marginTop : "50px" } } >
56
64
Upload
57
65
</ Button >
58
-
66
+ < Modal
67
+ title = "Confirmation"
68
+ visible = { isModalVisible }
69
+ onOk = { handleSubmit }
70
+ onCancel = { handleCancel } >
71
+ style={ {
72
+ overflow : 'auto' ,
73
+ borderRadius : '10px' ,
74
+ backgroundColor : '#1890ff' ,
75
+ } }
76
+ < p > Are you sure to upload the following file?</ p >
77
+ { fileData && < p > File: { fileData . name } </ p > }
78
+ </ Modal >
59
79
</ Card >
60
80
</ div >
61
81
) ;
62
82
}
63
- export default UploadAlt ;
83
+ export default UploadAlt ;
You can’t perform that action at this time.
0 commit comments