diff --git a/src/components/TestUrl_new.js b/src/components/TestUrl_new.js index 6b6a47d..b3f3e10 100644 --- a/src/components/TestUrl_new.js +++ b/src/components/TestUrl_new.js @@ -910,6 +910,8 @@ const TestUrl_New = (props) => { setLoading(true); var formData = new FormData(); formData.append("file", audiofile); + const stored_cookie = getCookie('tokenmysypart'); + formData.append("token", stored_cookie); var api_url = process.env.REACT_APP_API_URL + "myclass/api/mysy_openai_get_voice_file/"; /* @@ -926,7 +928,6 @@ const TestUrl_New = (props) => { // On efface l'_id de l'instruction en cours setcollection_instruction_id(""); - console.log(" #### formData = ", formData); } fetch( @@ -942,6 +943,9 @@ const TestUrl_New = (props) => { console.log('send_audio_file_to_server_blob message == :', result['message']); console.log('send_audio_file_to_server_blob collection_instruction_id == :', result['collection_instruction_id']); console.log('send_audio_file_to_server_blob result == :', result); + if (result['repeat_instruction']) { + console.log('repeat_instruction repeat_instruction repeat_instruction == zz', result['repeat_instruction']); + } //setisimgSelected(false); @@ -952,10 +956,16 @@ const TestUrl_New = (props) => { let local_audio_file = new Audio(document_mp3); local_audio_file.play(); } - - if (result['collection_instruction_id']) { + if (result['repeat_instruction'] && result['repeat_instruction'] === "1" && result['collection_instruction_id']) { setcollection_instruction_id(result['collection_instruction_id']); - }else{ + } + else if (result['repeat_instruction'] && result['repeat_instruction'] !== "1" ) { + setcollection_instruction_id(""); + } + + else if (result['collection_instruction_id']) { + setcollection_instruction_id(result['collection_instruction_id']); + } else { setcollection_instruction_id(""); } @@ -967,7 +977,7 @@ const TestUrl_New = (props) => { }) .catch((error) => { setLoading(false); - console.error('Error - send_audi_blob:'); + console.error('Error - send_audi_blob:', error); // setisimgSelected(true); }); }; @@ -1243,33 +1253,18 @@ const TestUrl_New = (props) => {
collection_instruction_id = '{collection_instruction_id}'
- { String(collection_instruction_id).length > 5 && } - { String(collection_instruction_id).length <= 5 && } + {String(collection_instruction_id).length > 5 && } + {String(collection_instruction_id).length <= 5 && } addAudioElement(blob)} recorderControls={recorderControls} // downloadOnSavePress={true} downloadFileExtension="mp3" - showVisualizer="false" - />
-
- -
- - file = {blob_recorded_file}
-
-
- - - - - -
- ; +