lokytech5 / e-get-why

An open-source social networking platform for Nigerians to share their frustrations, societal issues, and professional challenges.
https://e-get-why.vercel.app
MIT License
0 stars 2 forks source link

Set Up Axios API Client #21

Closed lokytech5 closed 4 months ago

lokytech5 commented 4 months ago

Feature Request: Set Up Axios API Client

Description

This task's goal is to install Axios for making HTTP requests and create an API client to handle interactions with the backend. The API client will be used throughout the application for making network requests.

Tasks

  1. Navigate to the forntend folder from your terminal with this command

      cd frontend
  2. Install Axios:

    • Install Axios using npm.
      npm install axios
  3. Create API Client:

    • Create a new file called apiClient.ts in the app/components directory.
    • Set up an Axios instance with a base URL and necessary headers.
    • Use the following base URL for the Axios instance: https://olikwzthj7.execute-api.us-east-1.amazonaws.com/dev.
    • Add meaningful comments when setting up the Axios instance.
  4. Implement Interceptors:

    • Add interceptors to handle request and response globally.
    • Ensure to include authorization tokens in requests.
    • Handle errors globally, such as redirecting to login on 401 errors.

Additional Notes

aedoardo1990 commented 4 months ago

good morning @lokytech5! I have created the merge request

lokytech5 commented 4 months ago

good morning, hope you good