Skip to content

added the getting data by seraching in bar

mondyagu abhilash requested to merge fetch into main

Added Dynamic API-Based Search Functionality

Overview

Implemented intelligent search functionality in the Kisan Mandi application to dynamically fetch commodity data from the Government mandi API based on user search queries.

Features Added

  • Added live search support using the search bar

  • Fetches real-time mandi data from API endpoint

  • Supports searching for:

    • commodity names
    • market names
    • district names
    • state names
  • Dynamic API request generation based on user input

  • Added loading and error handling states

  • Added empty result handling

  • Implemented responsive search results display

  • Added console debugging for API requests and responses

Example Searches

  • Tomato
  • Onion
  • Rice
  • Cotton
  • Hyderabad market
  • Telangana tomato prices
  • Andhra Pradesh onion prices

Technical Changes

  • Updated API fetching logic
  • Added search-based filtering
  • Improved React state management
  • Added async/await API handling
  • Integrated dynamic endpoint querying

Files Updated

  • Search component
  • API service layer
  • State handling logic
  • Fetch utilities

Result

Users can now search any commodity or mandi-related query directly from the search bar and receive live API data dynamically.

Edited by mondyagu abhilash

Merge request reports

Loading