Reactjs 我在reducer中的语法有什么问题?

Reactjs 我在reducer中的语法有什么问题?,reactjs,redux,Reactjs,Redux,我正在尝试向我的减速机添加调度。但是,我在语法方面遇到了一个问题。我不确定如何修复此错误。我在减速器中使用POST方法 export function insertSearchTerm(searchTerm) { return (dispatch) => { fetch('http://localhost:3001/api/v1/searches?searchterm='+searchTerm { headers: { 'Content-

我正在尝试向我的减速机添加调度。但是,我在语法方面遇到了一个问题。我不确定如何修复此错误。我在减速器中使用POST方法

export function insertSearchTerm(searchTerm) {
   return (dispatch) => {
     fetch('http://localhost:3001/api/v1/searches?searchterm='+searchTerm {
        headers: {
          'Content-Type':'application/json',  
        },
        method:'POST',
        body: JSON.stringify(searchTerm)          searchTerm
      }).then(res => console.log('D') {
          dispatch({
             type:'INSERT_TOP_SEARCH',
             payload: res
          })
        }
      )
     }
   }


./src/actions/insertSearchTerm.js
  Line 4:  Parsing error: Unexpected token, expected ","

  2 | 
  3 |    return (dispatch) => {
> 4 |      fetch('http://localhost:3001/api/v1/searches?searchterm='+ searchTerm {
    |                                                                            ^
  5 |         headers: {
  6 |           'Content-Type':'application/json'
  7 |         },

在搜索词后添加“,”

return (dispatch) => {
    fetch('http://localhost:3001/api/v1/searches?searchterm='+ searchTerm, {
        headers: {
       'Content-Type':'application/json'
    }
  }
}

如错误所示,添加逗号。以打字错误结束。啊..谢谢!