am using React's fetch() method to login in to my service.
So far I have done as below, you can check out my stuffs :
_callApiForLogin = () => {
ToastAndroid.show('Logging In...', ToastAndroid.SHORT);
let data = new FormData();
data.append('username', "sssss");
data.append('password', "123456");
data.append('device_token', "hjkhjkhjkkksdkjhkjhksdsfs");
data.append('device_type', "2");
fetch('https://612.33.196.54/~yes/master/api/web/login', {
method: 'POST',
body: data,
}).then((response) => response.json())
.then((responseJson) => {
ToastAndroid.show('Logging In...', responseJson);
if (responseJson.status === '1') {
ToastAndroid.show('Logging Successful' + responseJson, ToastAndroid.SHORT);
}
return responseJson.status;
})
.catch((error) => {
console.error(error);
});
}
But, getting below error in response.
Error :
com.facebook.react.bridge.ReadableNativeMap cannot be cast to java.lang.Double
The response coming from the service is as below :
{
"status": 1,
"data": {
"id": "551",
"first_name": "sssss",
"last_name": "lastname",
"email": "[email protected]",
"username": "sssss",
"password": "e10adc83e",
"photo": "",
"birthdate": "1963-02-13",
"gender": "",
"token": "1234567890",
"device_type": "2"
},
"message": "Successful Login"
}
What might be the issue ??
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…