File tree Expand file tree Collapse file tree 1 file changed +10
-1
lines changed
linkstash-frontend/src/app/import Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -45,6 +45,15 @@ export default function FileUploadForm() {
4545 const formData = new FormData ( ) ;
4646 formData . append ( "file" , file ) ;
4747
48+ const defaultTimeout = "5000" ; // Default value in milliseconds
49+ const timeoutEnv = process . env . IMPORT_TIMEOUT ?process . env . IMPORT_TIMEOUT :defaultTimeout ;
50+ let parsedTimeout :number = parseInt ( timeoutEnv , 10 ) ;
51+ if ( isNaN ( parsedTimeout ) ) {
52+ parsedTimeout = parseInt ( defaultTimeout )
53+ }
54+
55+
56+
4857 const apiOptions : ApiCallOptions = {
4958 endpoint : "/import" ,
5059 method : "POST" ,
@@ -53,7 +62,7 @@ export default function FileUploadForm() {
5362 Authorization : "Bearer " . concat ( AuthenticationState . token ) ,
5463 "content-type" : "multipart/form-data" ,
5564 } ,
56- timeout : process . env . IMPORT_TIMEOUT ,
65+ timeout : parsedTimeout ,
5766 successCallback : ( _response : any ) => {
5867 setUploadStatus ( {
5968 type : "success" ,
You can’t perform that action at this time.
0 commit comments