我已阅读此处有关 Axios 400 错误请求的所有问题,但找不到解决方案。我有一个在 useEffect 期间调用的函数,它首先从我的 API 获取数据,然后根据其他因素可能需要 POST 回 API。
GET 调用完美无缺,但 POST 调用一直失败。
const home = match.homeTeam.team_name
const homeScore = null
const away = match.awayTeam.team_name
const awayScore = null
const gameID = match.fixture_id
const result = ""
const points = null
const teamName = userInfo.state.teamName
const date = match.event_date
const status = match.statusShort
const realHomeScore = null
const realAwayScore = null
const homeLogo = match.homeTeam.logo
const awayLogo = match.awayTeam.logo
axios.post('/picks/add/', { home, homeScore, away, awayScore, gameID, result, points, …Run Code Online (Sandbox Code Playgroud)