File tree Expand file tree Collapse file tree 3 files changed +18
-3
lines changed Expand file tree Collapse file tree 3 files changed +18
-3
lines changed Original file line number Diff line number Diff line change 21
21
< p > Ready Meals</ p >
22
22
</ div >
23
23
< div class ="nav-buttons ">
24
- < a href ="index.html " class ="nav-button "> Home</ a >
24
+ < a href ="index.html " class ="nav-button "
25
+ > Meals(< span id ="meal-counter "> </ span > )</ a
26
+ >
25
27
< a href ="#Planets " class ="nav-button "> Planets</ a >
26
28
< a href ="#Races " class ="nav-button "> Races</ a >
27
29
</ div >
Original file line number Diff line number Diff line change 1
1
import './style/style.css' ;
2
2
3
3
import API from './modules/data' ;
4
+ import counter from './modules/counter' ;
4
5
import render from './modules/render/meals' ;
5
6
7
+ const mealCounter = document . getElementById ( 'meal-counter' ) ;
8
+
6
9
const endpoint = 'https://www.themealdb.com/api/json/v1/1/' ;
7
- const likesEndpoint = 'https://us-central1-involvement-api.cloudfunctions.net/capstoneApi/apps/lvQFdeSbvijlsDX1Y4VY/likes/' ;
10
+ const likesEndpoint =
11
+ 'https://us-central1-involvement-api.cloudfunctions.net/capstoneApi/apps/lvQFdeSbvijlsDX1Y4VY/likes/' ;
8
12
9
13
const displayMeals = ( ) => {
10
14
Promise . all ( [
11
15
API . getMeals ( `${ endpoint } search.php?f=b` ) ,
12
16
API . getLikes ( likesEndpoint ) ,
13
17
] ) . then ( ( data ) => {
14
18
render ( data [ 0 ] , data [ 1 ] ) ;
19
+ const length = counter . meals ( data [ 0 ] . meals ) ;
20
+ mealCounter . innerText = length ;
15
21
} ) ;
16
22
} ;
17
23
18
- window . addEventListener ( 'load' , displayMeals ) ;
24
+ window . addEventListener ( 'load' , displayMeals ) ;
Original file line number Diff line number Diff line change
1
+ const counter = {
2
+ meals : ( allMeals ) => allMeals . length ,
3
+ comments : ( allComments ) => allComments . length ,
4
+ reservation : ( allReservations ) => allReservations . length ,
5
+ } ;
6
+
7
+ export default counter ;
You can’t perform that action at this time.
0 commit comments