Im unable to ping feathers server from react native.
Closed this issue · 3 comments
PManager1 commented
ERROR
12:02:42 PM
{"line":97280,"column":24,"sourceURL":"http://packager.ub-4yw.libertytrust.jobs-x-15.exp.direct:80/main.bundle?platform=ios&dev=true&strict=false&minify=false&hot=true&assetPlugin=expo/tools/hashAssetFiles","config":{"transformRequest":{},"transformResponse":{},"timeout":0,"xsrfCookieName":"XSRF-TOKEN","xsrfHeaderName":"X-XSRF-TOKEN","maxContentLength":-1,"headers":{"Accept":"application/json, text/plain, */*","Content-Type":"application/json;charset=utf-8"},"method":"post","url":"http://localhost:3030/authentication","data":"{\"email\":\"liberty@gmail.com\",\"password\":\"password\",\"strategy\":\"local\"}"},"request":{"UNSENT":0,"OPENED":1,"HEADERS_RECEIVED":2,"LOADING":3,"DONE":4,"readyState":4,"status":0,"timeout":0,"withCredentials":false,"upload":{},"_aborted":false,"_hasError":true,"_method":"POST","_response":"Could not connect to the server.","_url":"http://localhost:3030/authentication","_timedOut":false,"_trackingName":"unknown","_incrementalEvents":false,"_requestId":null,"_headers":{"accept":"application/json, text/plain, */*","content-type":"application/json;charset=utf-8"},"_responseType":"","_sent":true,"_lowerCaseResponseHeaders":{},"_subscriptions":[]}}
export * from './auth_actions';
export * from './job_actions';
import axios from 'axios';
// const ROOT_URL = 'http://localhost:3030/';
const ROOT_URL = 'http://localhost:3030';
export function signinUser({email, password}) {
console.log('9- calling the signinUser inside the actions file');
// redux thunk gives us access to the Dispatch
return function (dispatch) {
// { email: email, password: password }
// axios.post( `${ROOT_URL}/authentication`, {email,password, strategy: 'local'} )
axios.post( `${ROOT_URL}/authentication`, {email: email, password:password, strategy: 'local'})
.then(response => {
console.log('it worked');
console.log(response);
}).catch(err => {
console.log('ERROR');
console.log(err);
});
// dispatch({ type: })
// submit email password to server
// if reqeust is good, we'll update the state to indicate user is authetnicated.
// save the JWT token
// redirect to route/feature navigate 'mAp'
// if error : show errror
}
}
daffl commented
I'm pretty sure this is a setting in React Native to allow external requests and open up both localhost
and port 3030
but @corymsmith might know more about this.
corymsmith commented
Are you running this on device or the simulator? And is it on Android or iOS? iOS by default blocks non HTTPS urls:
PManager1 commented
I got it covered, it was my fault.
Pinging local host from Iphone expo
…Sent from my iPhone
On Jul 1, 2017, at 3:21 PM, Cory Smith ***@***.***> wrote:
Are you running this on device or the simulator? And is it on Android or iOS? iOS by default blocks non HTTPS urls:
https://stackoverflow.com/questions/38501012/is-it-safe-to-add-localhost-to-app-transport-security-ats-nsexceptiondomains
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub, or mute the thread.