Skip to content

Im unable to ping feathers server from react native. #50

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
PManager1 opened this issue Jun 30, 2017 · 3 comments
Closed

Im unable to ping feathers server from react native. #50

PManager1 opened this issue Jun 30, 2017 · 3 comments

Comments

@PManager1
Copy link

PManager1 commented Jun 30, 2017

image

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\":\"[email protected]\",\"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
Copy link
Member

daffl commented Jul 1, 2017

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
Copy link
Contributor

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

@PManager1
Copy link
Author

PManager1 commented Jul 1, 2017 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants