Исключение в HostFunction: искаженные вызовы из JS: размеры полей разные - PullRequest
0 голосов
/ 28 сентября 2019

Я пытаюсь отправить почтовый запрос на сервер, но приложение продолжает выдавать эту ошибку:

Исключение в HostFunction: искаженные вызовы из JS: размеры полей различны.

[[46,11,46], [1,0,0], [[462], [465,2000,156969121, false]], 1591]

Сервер был протестирован и сохраняетДанные, когда я отправляю с помощью curl из командной строки.

Это функция, которая обрабатывает запрос

handleComment = async ()=>{
        const {comment, isAuth} = this.state;
        const userToken = await AsyncStorage.getItem('userToken');
        const token = "Token "+ userToken;

        if(isAuth!==null&&isAuth===true){
            if(
                comment!==null&&
                comment!==undefined
            ){

                const endpoint ='http://10.0.2.2:8000/api/comments/create/';
                const payload = {
                    comment: comment,
                    post: [this.props.postID]
                };

                axios.post(endpoint, payload, {
                    headers:{
                        'Auuthorization': token
                    }
                })
                    .then(response =>{
                        if(response!==null&&response!==undefined){

                            Alert.alert('Success', 'Your comment was successfully sent.');
                        }else{
                            Alert.alert('Comment send error', 'Your comment could not be sent.');
                        }

                    }).catch(error=>{
                        console.log(error);
                    })

            }else{
                Alert.alert('Comment send error', 'Please write your comment before sending.');
            }
        }else{
            Alert.alert('Authorization error', 'You need to login before sending a comment.');
        }
    }

...