I'm trying to query from a table where the teacherId is equal to the teacherId of the person that logs in but I can't pass that teacherId from the front-end to the back-end.
This is the back end
app.get("/api/get", async(req,res) => {
    const teacherId = req.body.teacherId
    connection.query(
        "SELECT class FROM homework WHERE teacherID = ?",
        [teacherId],
        (err, result) => {
            if (result){
                res.send({ message: result })
            } else{
                console.log(err)
            }
        }
    )
})
This is the front end
 useEffect(() => {
        Axios.get("http://localhost:1337/api/get", {
            teacherId: teacherId
        }).then((response) => {
            if(response){
                setDisplayHomework(response.data.message)
            } else{
                console.log("error")
            }
        })
    })
const teacherId = localStorage.getItem("teacherId")
I think the problem lies where it says teacherId: teacherId but I don't know why.
 
     
     
     
    