Nantes Université

Skip to content
Extraits de code Groupes Projets
Valider 91cb5506 rédigé par Selma EL BABARTI's avatar Selma EL BABARTI
Parcourir les fichiers

code tutorat

parent a2d85d2e
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
Pipeline #72915 réussi
......@@ -3,7 +3,7 @@ var pageUrl = window.location.pathname; // renvoie l'URL de la page
var pageID = pageUrl.substring(pageUrl.lastIndexOf('/')+1, pageUrl.lastIndexOf('.'));
const base_url = 'http://127.0.0.1:8899';
const auth_token = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJlbWFpbCI6InNlbG1hLmVsYmFiYXJ0aUBnbWFpbC5jb20iLCJmaXJzdG5hbWUiOm51bGwsImxhc3RuYW1lIjpudWxsLCJpZCI6InVzX2g0bTBxM2VnNDM0eGJ4Iiwicm9sZXMiOiJvcmctbGV2ZWwtY3JlYXRvcixzdXBlciIsInRva2VuX3ZlcnNpb24iOiI4YmIwMjBjYjQ5YmVjMjJlOGQzNGY4YjkzOGQ2NDc4OTczYWY4ZTFlZDBiZjIxNzQ0YzFkNzliMGM2MGY2ZjAzMGEwYTI3OWFhY2VlMzk4YSIsImlhdCI6MTY4NDA2MzcyMiwiZXhwIjoxNjg0MDk5NzIyfQ.xO_OQkVzHBgB3FwXdT7BlfM-oalruQzETAQlnBlZuTo';
const auth_token = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJlbWFpbCI6InNlbG1hLmVsYmFiYXJ0aUBnbWFpbC5jb20iLCJmaXJzdG5hbWUiOm51bGwsImxhc3RuYW1lIjpudWxsLCJpZCI6InVzX2g0bTBxM2VnNDM0eGJ4Iiwicm9sZXMiOiJvcmctbGV2ZWwtY3JlYXRvcixzdXBlciIsInRva2VuX3ZlcnNpb24iOiI4YmIwMjBjYjQ5YmVjMjJlOGQzNGY4YjkzOGQ2NDc4OTczYWY4ZTFlZDBiZjIxNzQ0YzFkNzliMGM2MGY2ZjAzMGEwYTI3OWFhY2VlMzk4YSIsImlhdCI6MTY4NDIxOTI3NywiZXhwIjoxNjg0MjU1Mjc3fQ.mUFSHuT02Lva9H4s6CG8aOonQGQVNvW6EA7C4n8g1EA';
async function getFromAPI(url){
let req = await fetch(url, {
......@@ -24,12 +24,12 @@ async function loadpays()
{
const select = document.getElementsByClassName('liste_pays');
const list_pays = await getFromAPI(base_url+'/api/v1/db/data/v1/Latino/Pays/views/Pays');
for (const pays of list_pays) {
const option = document.createElement('option');//on crée une nouvelle option
option.value = pays.IdPays;
option.textContent = pays.Nom;
select.appendChild(option);//on ajoute cette option au menu déroulant
}
// for (const pays of list_pays) {
// const option = document.createElement('option');//on crée une nouvelle option
// option.value = pays.IdPays;
// option.textContent = pays.Nom;
// select.appendChild(option);//on ajoute cette option au menu déroulant
// }
}
loadpays()
......@@ -37,38 +37,43 @@ loadpays()
async function loadOptions()
{
const selectNature = document.getElementsByClassName('liste_nature');
const selectCuisine = document.getElementsByClassName('liste_cuisine');
const selectCuisine = document.getElementById('modificuisine');
const selectCulture = document.getElementsByClassName('liste_culture');
const selectSport = document.getElementsByClassName('liste_sport');
const list_cuisine= await getFromAPI(base_url+'/api/v1/db/data/v1/Latino/Cuisine');
for (const cuisine of list_cuisine) {
console.log(list_cuisine.list)
for (const cuisine of list_cuisine.list) {
const optionCui = document.createElement('option');//on crée une nouvelle option
optionCui.value = cuisine.IdCuisine;
optionCui.textContent = cuisine.Nom;
console.log(selectCuisine)
selectCuisine.appendChild(optionCui);//on ajoute cette option au menu déroulant
}
}
const list_nature= await getFromAPI(base_url+'/api/v1/db/data/v1/Latino/Nature');
for (const nature of list_nature) {
const optionNat = document.createElement('option');//on crée une nouvelle option
optionNat.value = nature.IdNature;
optionNat.textContent = nature.Nom;
selectNature.appendChild(optionNat);//on ajoute cette option au menu déroulant
}
const list_culture= await getFromAPI(base_url+'/api/v1/db/data/v1/Latino/Culture');
for (const culture of list_culture) {
const optionCult = document.createElement('option');//on crée une nouvelle option
optionCult.value = culture.IdCulture;
optionCult.textContent = culture.Nom;
selectCulture.appendChild(optionCult);//on ajoute cette option au menu déroulant
}
const list_sport= await getFromAPI(base_url+'/api/v1/db/data/v1/Latino/Sport');
for (const sport of list_sport) {
const optionSport = document.createElement('option');//on crée une nouvelle option
optionSport.value = sport.IdSport;
optionSport.textContent = sport.Nom;
selectSport.appendChild(optionSport);//on ajoute cette option au menu déroulant
}
// for (const nature of list_nature) {
// const optionNat = document.createElement('option');//on crée une nouvelle option
// optionNat.value = nature.IdNature;
// optionNat.textContent = nature.Nom;
// selectNature.appendChild(optionNat);//on ajoute cette option au menu déroulant
// }
// const list_culture= await getFromAPI(base_url+'/api/v1/db/data/v1/Latino/Culture');
// for (const culture of list_culture) {
// const optionCult = document.createElement('option');//on crée une nouvelle option
// optionCult.value = culture.IdCulture;
// optionCult.textContent = culture.Nom;
// selectCulture.appendChild(optionCult);//on ajoute cette option au menu déroulant
// }
// const list_sport= await getFromAPI(base_url+'/api/v1/db/data/v1/Latino/Sport');
// for (const sport of list_sport) {
// const optionSport = document.createElement('option');//on crée une nouvelle option
// optionSport.value = sport.IdSport;
// optionSport.textContent = sport.Nom;
// selectSport.appendChild(optionSport);//on ajoute cette option au menu déroulant
// }
}
loadOptions()
......
......@@ -4,7 +4,7 @@
const emailInput = document.getElementById('mail');
const passwordInput = document.getElementById('password');
const loginButton = document.getElementById('loginBouton');
const auth_token = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJlbWFpbCI6InNlbG1hLmVsYmFiYXJ0aUBnbWFpbC5jb20iLCJmaXJzdG5hbWUiOm51bGwsImxhc3RuYW1lIjpudWxsLCJpZCI6InVzX2g0bTBxM2VnNDM0eGJ4Iiwicm9sZXMiOiJvcmctbGV2ZWwtY3JlYXRvcixzdXBlciIsInRva2VuX3ZlcnNpb24iOiI4YmIwMjBjYjQ5YmVjMjJlOGQzNGY4YjkzOGQ2NDc4OTczYWY4ZTFlZDBiZjIxNzQ0YzFkNzliMGM2MGY2ZjAzMGEwYTI3OWFhY2VlMzk4YSIsImlhdCI6MTY4NDA2MzcyMiwiZXhwIjoxNjg0MDk5NzIyfQ.xO_OQkVzHBgB3FwXdT7BlfM-oalruQzETAQlnBlZuTo';
const auth_token = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJlbWFpbCI6InNlbG1hLmVsYmFiYXJ0aUBnbWFpbC5jb20iLCJmaXJzdG5hbWUiOm51bGwsImxhc3RuYW1lIjpudWxsLCJpZCI6InVzX2g0bTBxM2VnNDM0eGJ4Iiwicm9sZXMiOiJvcmctbGV2ZWwtY3JlYXRvcixzdXBlciIsInRva2VuX3ZlcnNpb24iOiI4YmIwMjBjYjQ5YmVjMjJlOGQzNGY4YjkzOGQ2NDc4OTczYWY4ZTFlZDBiZjIxNzQ0YzFkNzliMGM2MGY2ZjAzMGEwYTI3OWFhY2VlMzk4YSIsImlhdCI6MTY4NDIxOTI3NywiZXhwIjoxNjg0MjU1Mjc3fQ.mUFSHuT02Lva9H4s6CG8aOonQGQVNvW6EA7C4n8g1EA';
// Écouter l'événement click sur le bouton de connexion: c'est cet évènement qui fait le lien avec la BDD
......
Aucun aperçu pour ce type de fichier
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter