maj
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
async function PopulateSelect(mySelect,id){
|
||||
let data=[]
|
||||
if(mySelect.name=="metriques" && id!=null){
|
||||
if(mySelect.name=="videos" && id!=null){
|
||||
data=await getDataProjectVideosFromApi(id);
|
||||
for(let i = 0 ; i < data.length ; i++){
|
||||
const selectObj=document.createElement("option")
|
||||
@@ -25,5 +25,20 @@ async function getDataProjectVideosFromApi(id) {
|
||||
throw error; // Re-throw the error to handle it outside the function if needed
|
||||
}
|
||||
}
|
||||
|
||||
async function getDataVideoFromApi(id) {
|
||||
try {
|
||||
const response = await $.ajax({
|
||||
url: api_url.concat(`/videos/${id}`),
|
||||
method: "GET",
|
||||
dataType: "json",
|
||||
});
|
||||
// If the request is successful, store the data in the cache and return it
|
||||
return response;
|
||||
} catch (error) {
|
||||
console.error("Error fetching data:", error);
|
||||
throw error; // Re-throw the error to handle it outside the function if needed
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user