I could not fetch the data using axios, despite fetching it succesfully through postman. Not sure why this is happening
Here's my function in react
import axios from "axios";
const url = "http://localhost:3001/tasks/";
const getDashboardData = async (setTasks) => {
  await axios.get(`${url}`, {
    uid: sessionStorage.getItem("uid")
  })
    .then((result) => {
      console.log(result.data);
      setTasks(result.data);
    })
    .catch((error) => {
      console.log(error);
    })
}
Web app side
import React, { useContext, useEffect, useState } from 'react'
import { UserContext } from '../layout/Layout';
import { getDashboardData, handleCreate } from './DashboardScripts';
const Dashboard = () => {
  const {user, setUser} = useContext(UserContext);
  const [tasks, setTasks] = useState(null);
  useEffect(() => { getDashboardData(setTasks) }, []);
...
Here's my server side code
// Returns all tasks
router.get("/", async (req, res) => {
  let uid = req.body.uid;
  await db.collection("users").doc(uid).collection("tasks").get()
    .then((querySnapshot) => {
      let tasksTemp = [];
      querySnapshot.forEach((doc) => {
        // doc.data() is never undefined for query doc snapshots
        tasksTemp.push([doc.id, doc.data()]);
      });
      res.status(200).send(tasksTemp);
    })
    .catch((error) => {
      res.status(400).send(error.message);
    });
})
Postman screenshot Postman
I'm not sure whether I'm writing the Axios request properly, or whether I'm calling it the function wrongly from the web app. I tried different ways of writing the Axios request to no avail
 
    