@@ -297,7 +297,7 @@ const createRecipeElement = async (recipe) => {
297
297
const imgDiv = document . createElement ( 'div' ) ;
298
298
imgDiv . classList . add ( 'imgDiv' ) ;
299
299
const img = document . createElement ( 'img' ) ;
300
- img . src = recipe . photoPath ;
300
+ img . src = recipe . recipe . photoPath ;
301
301
img . alt = 'Recipe Photo' ;
302
302
303
303
// Apply CSS to constrain image size
@@ -310,7 +310,7 @@ const createRecipeElement = async (recipe) => {
310
310
const starContainer = document . createElement ( 'div' ) ;
311
311
starContainer . classList . add ( 'rating' ) ;
312
312
313
- const getCustomData = await getCustomDataOfDashboard ( recipeIndex ) ;
313
+ const getCustomData = await getSelectedCustomDataOfDashboard ( recipeIndex ) ;
314
314
const rate = getCustomData . rate ;
315
315
// const recipeId = getStarAndHeartInfo.recipe.id;
316
316
// const getRateInfo = getStarAndHeartInfo[0].rateResponseList[0].rate;
@@ -372,7 +372,7 @@ const createRecipeElement = async (recipe) => {
372
372
// Title
373
373
const titleDiv = document . createElement ( 'div' ) ;
374
374
titleDiv . classList . add ( 'titleDiv' ) ;
375
- titleDiv . textContent = recipe . title ;
375
+ titleDiv . textContent = recipe . recipe . title ;
376
376
377
377
// Append stars and heart to the recipeDiv
378
378
recipeDiv . appendChild ( imgDiv ) ;
@@ -400,11 +400,11 @@ const displayDashboard = async (recipes) => {
400
400
// This fetch method closed in order to reduce usage of database. Open before starting development
401
401
const fetchData = async ( ) => {
402
402
try {
403
- const response = await fetch ( 'https://recipiebeckend.azurewebsites.net/recipes/all-recipes ' ) ;
403
+ const response = await fetch ( 'https://recipiebeckend.azurewebsites.net/recipes/get-custom-data-dashboard ' ) ;
404
404
const data = await response . json ( ) ;
405
405
406
406
console . log ( 'Fetched Data:' , data ) ;
407
- // Call displayDashboard to render the fetched data
407
+
408
408
displayDashboard ( data ) ;
409
409
} catch ( error ) {
410
410
console . error ( 'Error fetching or displaying data:' , error ) ;
@@ -413,6 +413,9 @@ const fetchData = async () => {
413
413
414
414
// Call fetchData to initiate the process
415
415
fetchData ( ) ;
416
+ // let i = 1;
417
+ // console.log("Fetch çalıştı " + i)
418
+ // i+1;
416
419
417
420
const fetchDataByMealType = async ( mealType ) => {
418
421
try {
@@ -517,6 +520,7 @@ function fetchSortByTime() {
517
520
fetch ( 'https://recipiebeckend.azurewebsites.net/recipes/recipe-sort-preptime' )
518
521
. then ( response => response . json ( ) )
519
522
. then ( data => {
523
+ console . log ( "data ne: " , data ) ;
520
524
displayDashboard ( data ) ;
521
525
} )
522
526
. catch ( error => console . error ( 'Error fetching data:' , error ) ) ;
@@ -645,7 +649,7 @@ function basicSearch() {
645
649
// starAndHeartInfoArray.push(data);
646
650
// return starAndHeartInfoArray;
647
651
// }
648
- async function getCustomDataOfDashboard ( index ) {
652
+ async function getSelectedCustomDataOfDashboard ( index ) {
649
653
var apiUrl = 'https://recipiebeckend.azurewebsites.net/recipes/get-custom-data-dashboard' ;
650
654
const JWTAccessToken = sessionStorage . getItem ( 'accessToken' ) ;
651
655
const response = await fetch (
0 commit comments