我正在尝试使用Vue JS和Axios将数据(书)发布到我的Rails Api . 这是我的BookList组件的代码:

<script>
import BookForm from './BookForm';
export default {
  name: 'hello',
  data(){
    return{
    books: []
   }
  },
    mounted() {
      axios.get("http://localhost:3000/api/v1/books")
      .then(response => {this.books = response.data})
    },
    components:{
      BookForm
    },
    methods:{
      onClickForm(book){
        console.log(book)
        this.books.push(book)
        axios.post("http://localhost:3000/api/v1/books",{book})
        .then(function (response) {
        console.log(response);
        })
        console.log('Book created')
      }
    }
  }
</script>

我能够发布书籍对象,但我从控制台收到错误 . 看来我的axios post请求没有正确完成 . 请注意,我从BookForm组件发送book对象,发出与onClickForm方法相关的事件 . 我的方法有什么问题?谢谢

这是我从控制台得到的错误:
enter image description here

这是我从rails api服务器获得的消息:
enter image description here

这本书已创建,但我收到500内部错误 . 有帮助吗?谢谢