11import RecognizeFileExtension from "../../utils/get-data-url-type"
2- const setUrl = ( result , configImport ) => {
3- if ( configImport . loadProjectIsSelected ) {
2+ const setUrl = async ( result , configImport , dm ) => {
3+ var text
4+ var json
5+ if ( ! configImport . loadAssetIsSelected ) {
46 if ( RecognizeFileExtension ( result ) === "Image" ) {
57 return { imageUrl : `${ result } ` }
68 } else if ( RecognizeFileExtension ( result ) === "Video" ) {
@@ -10,8 +12,11 @@ const setUrl = (result, configImport) => {
1012 } else if ( RecognizeFileExtension ( result ) === "PDF" ) {
1113 return { pdfUrl : `${ result } ` }
1214 } else if ( RecognizeFileExtension ( result ) === "Text" ) {
13- //var text = await fetchTextInFile(result)
14- return { document : `Is not supported` /*${text}`*/ }
15+ text = await dm . getAssetText ( { txtUrl : `${ result } ` } )
16+ return { document : `${ text } ` }
17+ } else if ( configImport . typeOfFileToLoad === "Time" ) {
18+ json = await dm . getAssetTime ( { timeUrl : `${ result } ` } )
19+ return json
1520 }
1621 } else {
1722 if (
@@ -38,8 +43,14 @@ const setUrl = (result, configImport) => {
3843 RecognizeFileExtension ( result ) === configImport . typeOfFileToLoad &&
3944 configImport . typeOfFileToLoad === "Text"
4045 ) {
41- //var text = await fetchTextInFile(result)
42- return { document : `Is not supported` /*${text}`*/ }
46+ text = await dm . getAssetText ( { txtUrl : `${ result } ` } )
47+ return { document : `${ text } ` }
48+ } else if (
49+ RecognizeFileExtension ( result ) === configImport . typeOfFileToLoad &&
50+ configImport . typeOfFileToLoad === "Time"
51+ ) {
52+ json = await dm . getJSON ( result )
53+ return json
4354 }
4455 }
4556}
0 commit comments