私は学校のプロジェクトとアキシオにReact-nativeを使ってデータを取得します。私は応答を表示しようとすると、これは常にnullである、React-native axiosメソッドPOST response.data null
login(username, password){
axios({
method : 'post',
url : 'http://xxxx.xxxx.com/UserRestController.php',
data : {
accountId : 2
}
})
.then(function (response) {
console.log('data', response.data);
})
.catch(function (error) {
console.log(error);
});
}
: はここに私の関数です。
このよう data Object {
"config": Object {
"adapter": [Function xhrAdapter],
"data": "{\"accountId\":2}",
"headers": Object {
"Accept": "application/json, text/plain, */*",
"Content-Type": "application/json;charset=utf-8",
},
"maxContentLength": -1,
"method": "post",
"timeout": 0,
"transformRequest": Object {
"0": [Function transformRequest],
},
"transformResponse": Object {
"0": [Function transformResponse],
},
"url": "http://ariary.vola.mg/UserRestController.php",
"validateStatus": [Function validateStatus],
"xsrfCookieName": "XSRF-TOKEN",
"xsrfHeaderName": "X-XSRF-TOKEN",
},
"data": "",
"headers": Object {
"access-control-allow-origin": "*",
"connection": "keep-alive",
"content-type": "text/html; charset=UTF-8",
"date": "Mon, 31 Jul 2017 13:29:28 GMT",
"server": "nginx",
"transfer-encoding": "chunked",
"vary": "Accept-Encoding",
"x-powered-by": "EasyEngine 3.7.4",
},
"request": XMLHttpRequest {
"DONE": 4,
"HEADERS_RECEIVED": 2,
私は別の関数でaxios.GETを使用し、それは素晴らしい作品。誰か助けてくれますか? おかげ
ありがとう、どうやって削除できますか? –