How to use the react-native-config.API_PORT 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
            .get(env.API_HOST + `:` + env.API_PORT + `/api/v1/auth/me?access_token=${token}`)
            .then(info => {
github 0mkara / RNAWebRTCApp / src / components / LoginComponent / index.js View on Github external
.then(res => {
        if (res.hasOwnProperty('data') && res.data.hasOwnProperty('access_token')) {
          const token = res.data.access_token;
          axios
            .get(env.API_HOST + `:` + env.API_PORT + `/api/v1/auth/me?access_token=${token}`)
            .then(info => {
              this.props.store.dispatch(set_user_info(info.data));
              AsyncStorage.setItem('access_token', res.data.access_token);
              ToastAndroid.show('Success', ToastAndroid.LONG);
              this.gotoHomePage();
              this.props.store.dispatch(login(true));
              this.props.store.dispatch(set_access_token(res.data.access_token));
            })
            .catch(err => {
              console.error(err);
            });
        }
      })
      .catch(err => {
github 0mkara / RNAWebRTCApp / src / components / RegistrationComponent / index.js View on Github external
async signup() {
    const name = this.state.name;
    const username = this.state.username;
    const email = this.state.email;
    const password = this.state.password;
    const phone = this.state.phone;
    const url = env.API_HOST + `:` + env.API_PORT + `/api/v1/register`;

    axios
      .post(url, { name, username, email, phone, password })
      .then(res => {
        if (res.hasOwnProperty('data') && res.data.hasOwnProperty('message') && res.data.message.toLowerCase() === 'registration successful') {
          Actions.login();
        }
      })
      .catch(e => {
        console.error(e);
      });
  }
github 0mkara / RNAWebRTCApp / src / components / GoogleSigninButton / GoogleSignInButon.js View on Github external
.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 => {});
github 0mkara / RNAWebRTCApp / src / components / ProfileComponent / index.js View on Github external
AsyncStorage.getItem('access_token').then(token => {
      const userInfo = {
        avatar: '',
        email: this.state.email,
        id: this.props.userInfo.id,
        name: this.state.name,
        phone: this.state.phone,
        username: this.state.username
      };

      axios.post(env.API_HOST + `:` + env.API_PORT + `/api/v1/auth/me?access_token=${token}`, userInfo).then(res => {
        if (res.hasOwnProperty('data') && res.data.message === 'Profile Updated') {
          this.props.store.dispatch(set_user_info(userInfo));
        }
      });
    });
  }