Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Filter restrictions #4

Closed
Shubh-Nisar opened this issue Oct 19, 2023 · 3 comments
Closed

Filter restrictions #4

Shubh-Nisar opened this issue Oct 19, 2023 · 3 comments

Comments

@Shubh-Nisar
Copy link
Owner

Form validation is blocking the user filters. For example, a user just names a recipe but does not want a budget constraint, he would not add a budget filter.

if (isNaN(budget) || budget <= 0) {
alert("Budget should be a positive number");
return;
}
if (isNaN(time) || time <= 0) {
alert("Time to cook should be a positive number");
return;
}
const response = await recipeDB
.get(
`/recipes?CleanedIngredients=${this.state.ingredients}&Cuisine=${this.state.ingredients}&budget=${budget}&TotalTimeInMins=${time}`,
)
.catch((err) => {
console.log(err, err.message);
});
if (response) {
console.log(response.data);
this.setState({
// cuisine : "Any",
//numberIngredients : 0,
ingredients: new Set(),
cuisineState: 0,
cuisine: "",
recipes: response.data.recipes,
});
} else {
console.log("Failed...");
}
};
handleSubmit = (event) => {
this.setState(
{
cuisine: document.getElementById("cuisine").value,
},
() => console.log(this.state),
);
if (this.state.cuisine.trim() === "") {
alert("Cuisine cannot be empty");
return;
}

@github-actions
Copy link

Custom comment added using Respost

Hello! Respost is here. This issue will be addressed by our contributors soon. Keep commenting and contributing.

@Neel317
Copy link
Collaborator

Neel317 commented Oct 20, 2023

I have resolved this issue. Individual filters are now enabled.

@Neel317 Neel317 closed this as completed Oct 20, 2023
@github-actions
Copy link

Custom comment added using Respost

Hello! Respost is here. This issue will be addressed by our contributors soon. Keep commenting and contributing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants