How to use the react-native-config.API_HOST function in react-native-config

To help you get started, we’ve selected a few react-native-config examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github 0mkara / RNAWebRTCApp / src / components / LoginComponent / index.js View on Github external
handleLogin = () => {
    const name = this.state.username;
    const password = this.state.password;
    // this.gotoHomePage()
    // this.props.store.dispatch(login(true));
    const url =
      env.API_HOST +
      `:` +
      env.API_PORT +
      `/api/v1/login?grant_type=password&client_id=client@letsgo&client_secret=Va4a8bFFhTJZdybnzyhjHjj6P9UVh7UL&scope=read&username=${name}&password=${password}`;

      // ! FOR DEVELOPMENT ONLY
      // const url =
      // env.API_HOST +
      // `:` +
      // env.API_PORT +
      // `/api/v1/login?grant_type=password&client_id=client@letsgo&client_secret=Va4a8bFFhTJZdybnzyhjHjj6P9UVh7UL&scope=read&username=a@a.com&password=1234`;
    axios
      .get(url)
      .then(res => {
        if (res.hasOwnProperty('data') && res.data.hasOwnProperty('access_token')) {
          const token = res.data.access_token;
          axios
github 0mkara / RNAWebRTCApp / src / components / GoogleSigninButton / GoogleSignInButon.js View on Github external
_signIn = async () => {
    try {
      await GoogleSignin.hasPlayServices({ showPlayServicesUpdateDialog: true });
      const userInfo = await GoogleSignin.signIn();
      const idToken = userInfo.idToken;

      axios
        .post(`${env.API_HOST}:${env.API_PORT}/api/v1/auth/google`, { idToken })
        .then(res => {
          axios
            .get(
              `${env.API_HOST}:${env.API_PORT}/api/v1/login?grant_type=client_credentials&client_id=google@letsgo&client_secret=Va4a8bFFhTJZdybnzyhjHjj6P9UVh7UL`
            )
            .then(res => {})
            .catch(err => {
              console.log(err);
            });
        })
        .catch(err => {});
    } catch (error) {}
  };
  render() {
github 0mkara / RNAWebRTCApp / src / components / ProfileComponent / index.js View on Github external
data => {
        axios
          .post(env.API_HOST + `:` + env.API_PORT + '/api/v1/user/coords', { lat: data.coords.latitude, long: data.coords.longitude })
          .then(res => {
            ToastAndroid.show('Location Sent Successfully', ToastAndroid.LONG);
          })
          .catch((e) => {
            ToastAndroid.show('Location Sent Failed', ToastAndroid.LONG);
          });
      },
      () => {