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

Multiple filters not working #1531

Open
AsilbekMelikov opened this issue Mar 19, 2024 · 0 comments
Open

Multiple filters not working #1531

AsilbekMelikov opened this issue Mar 19, 2024 · 0 comments

Comments

@AsilbekMelikov
Copy link

GET /electronics?id=1&id=2

When I tried to use filter based on this filter json-server did not response correctly.

[
  {
    "id": "1",
    "model": "samsung",
    "realPrice": "1128",
    "bonusPrice": "99.50",
    "feature": "metallic",
    "category": "smartphone",
    "image": "/Assets/images/image 22.png",
    "camera": "black"
  },
  {
    "id": "2",
    "model": "apple",
    "realPrice": "1128",
    "bonusPrice": "99.50",
    "feature": "plastic cover",
    "category": "smartphone",
    "image": "/Assets/images/image 23.png",
    "camera": "black"
  },
  {
    "id": "3",
    "model": "huawei",
    "realPrice": "1128",
    "bonusPrice": "99.50",
    "feature": "8GB Ram",
    "category": "smartphone",
    "image": "/Assets/images/image 28.png",
    "camera": "white"
  },
  {
    "id": "4",
    "model": "pocco",
    "realPrice": "1128",
    "bonusPrice": "99.50",
    "feature": "super power",
    "category": "smartphone",
    "image": "/Assets/images/image 32.png",
    "camera": "black"
  },
  {
    "id": "5",
    "model": "lenovo",
    "realPrice": "1128",
    "bonusPrice": "99.50",
    "feature": "large memory",
    "category": "smartphone",
    "image": "/Assets/images/image 33.png",
    "camera": "white"
  },
  {
    "id": "6",
    "model": "samsung",
    "realPrice": "1128",
    "bonusPrice": "99.50",
    "feature": "metallic",
    "category": "smartphone",
    "image": "/Assets/images/image 34.png",
    "camera": "black"
  },
  {
    "id": "7",
    "model": "apple",
    "realPrice": "1128",
    "bonusPrice": "99.50",
    "feature": "metallic",
    "category": "smartphone",
    "image": "/Assets/images/image 35.png",
    "camera": "red"
  },
  {
    "id": "8",
    "model": "huawei",
    "realPrice": "1128",
    "bonusPrice": "99.50",
    "feature": "metallic",
    "category": "smartphone",
    "image": "/Assets/images/image 23.png",
    "camera": "green"
  },
  {
    "id": "9",
    "model": "lenovo",
    "realPrice": "1128",
    "bonusPrice": "99.50",
    "feature": "metallic",
    "category": "smartphone",
    "image": "/Assets/images/image 22.png",
    "camera": "black"
  },
  {
    "id": "10",
    "model": "samsung",
    "realPrice": "1128",
    "bonusPrice": "99.50",
    "feature": "metallic",
    "category": "smartphone",
    "image": "/Assets/images/image 35.png",
    "camera": "black"
  },
  {
    "id": "11",
    "model": "apple",
    "realPrice": "1128",
    "bonusPrice": "99.50",
    "feature": "plastic cover",
    "category": "smartphone",
    "image": "/Assets/images/image 33.png",
    "camera": "black"
  },
  {
    "id": "12",
    "model": "huawei",
    "realPrice": "1128",
    "bonusPrice": "99.50",
    "feature": "8GB Ram",
    "category": "smartphone",
    "image": "/Assets/images/image 34.png",
    "camera": "white"
  },
  {
    "id": "13",
    "model": "pocco",
    "realPrice": "1128",
    "bonusPrice": "99.50",
    "feature": "super power",
    "category": "smartphone",
    "image": "/Assets/images/image 32.png",
    "camera": "black"
  },
  {
    "id": "14",
    "model": "lenovo",
    "realPrice": "1128",
    "bonusPrice": "99.50",
    "feature": "large memory",
    "category": "smartphone",
    "image": "/Assets/images/image 22.png",
    "camera": "white"
  },
  {
    "id": "15",
    "model": "samsung",
    "realPrice": "1128",
    "bonusPrice": "99.50",
    "feature": "metallic",
    "category": "smartphone",
    "image": "/Assets/images/image 23.png",
    "camera": "black"
  },
  {
    "id": "16",
    "model": "apple",
    "realPrice": "1128",
    "bonusPrice": "99.50",
    "feature": "metallic",
    "category": "smartphone",
    "image": "/Assets/images/image 28.png",
    "camera": "red"
  },
  {
    "id": "17",
    "model": "huawei",
    "realPrice": "1128",
    "bonusPrice": "99.50",
    "feature": "metallic",
    "category": "smartphone",
    "image": "/Assets/images/image 34.png",
    "camera": "green"
  },
  {
    "id": "18",
    "model": "lenovo",
    "realPrice": "1128",
    "bonusPrice": "99.50",
    "feature": "metallic",
    "category": "smartphone",
    "image": "/Assets/images/image 33.png",
    "camera": "black"
  },
  {
    "id": "10",
    "model": "samsung",
    "realPrice": "1128",
    "bonusPrice": "99.50",
    "feature": "metallic",
    "category": "smartphone",
    "image": "/Assets/images/image 35.png",
    "camera": "black"
  }
]

This is my db.json array was got by http://localhost:3000/electronics this one. But I want to get two same properties in a single filter string. like ?id=10&id=8 so on. How can I do it?

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

1 participant