我如何使用axios检索特定数据。现在它正在从数据库返回所有数据

问题描述 投票:-3回答:1

我如何使用axios检索特定数据。它从数据库返回所有数据。我的前端是react js,后端是python django从“ axios”导入axios;

从“ ./types”导入{GET_TA};

从“ os”导入{类型};

export const getTA =批次=>调度=> {

const config = {
 headers: {
   "Content-Type": "application/json"
 }
};
axios
 .get("/api/tarecommender")
 .then(res => {
   dispatch({
     type: GET_TA,
     payload: res.data
   });
 })
  .catch(err => console.log(err));``
};`

此代码从数据库返回了我所有的数据。如何从数据库中检索特定的ID。

javascript django reactjs axios
1个回答
© www.soinside.com 2019 - 2024. All rights reserved.