-
Notifications
You must be signed in to change notification settings - Fork 0
/
cuisineFilter.js
55 lines (47 loc) · 1.9 KB
/
cuisineFilter.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
import React,{Component} from 'react';
import axios from 'axios';
const cuisineurl = "https://developerfunnelrestapi.herokuapp.com/restaurantlist"
class CuisineFilter extends Component{
CuisineFilter = (event) => {
let cuisineType = event.target.value;
let meal = sessionStorage.getItem('mealid')
let crul;
if(cuisineType == ""){
crul = `${cuisineurl}/${meal}`
}else{
crul = `${cuisineurl}/${meal}?cuisine=${cuisineType}`
}
axios.get(crul)
.then((response) => {this.props.cuisinedata(response.data)})
}
render(){
return(
<React.Fragment>
<div className="costFltr">
<center>Cuisine Filter</center>
<div onChange={this.CuisineFilter}>
<label>
<input type="radio" value="" name="Cuisine"/>All
</label><br/>
<label>
<input type="radio" value="1" name="Cuisine"/>North Indian
</label><br/>
<label>
<input type="radio" value="2" name="Cuisine"/>South Indian
</label><br/>
<label className="">
<input type="radio" value="3" name="Cuisine"/>Chinese
</label><br/>
<label className="">
<input type="radio" value="4" name="Cuisine"/>Fast Food
</label>
<label className="">
<input type="radio" value="5" name="Cuisine"/>Street Food
</label>
</div>
</div>
</React.Fragment>
)
}
}
export default CuisineFilter;