AthletiFi / athletifi-website

Official website for AthletiFi
https://www.athleti.fi
1 stars 5 forks source link

Implement Data Fetching Logic for playerStats #135

Closed qisforq closed 3 months ago

qisforq commented 4 months ago

Objective

Implement data fetching logic for the "playerStats" component to retrieve and display individual player statistics from the API Gateway.

Tasks

  1. Backend Verification

    • [x] Confirm the Lambda function is capable of querying the database for individual player statistics.
    • [x] Ensure the API Gateway endpoint for retrieving player statistics is properly configured and accessible.
  2. Implement Route Handlers in Next.js

    • [x] Develop a new route handler for fetching individual player statistics from the API Gateway.
    • [x] Utilize axios within the route handler to perform HTTP GET requests to the API Gateway, targeting the endpoint designed to provide player statistics.
  3. Server-side Data Fetching

    • [x] Use the created Route Handler to fetch data on the server side, initiating API calls with the player_id to retrieve their statistics.
    • [x] Implement error handling within the Route Handler to effectively manage scenarios where data fetching fails or returns no results.
  4. Client-side Data Fetching and Integration

    • [x] On the client side, use the fetch API to retrieve data from the Route Handler, focusing on efficient data retrieval and modern web practices.
    • [x] Dynamically update the "playerStats" component with the fetched statistics, ensuring the component accurately reflects the player's performance data.