How to use the react-native-config.AUTH_TOKEN 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 Bit-Nation / BITNATION-Pangea-mobile / src / PangeaCore / UI / Chat / index.js View on Github external
: props.nationId; // hardcode for bitnation chat group
      const selectedNation = resolveNation(props.nations || [], nationIdX);
      if (!selectedNation) {
        if (Platform.OS === "ios") {
          props.navigator.pop();
        } else {
          props.navigator.dismissModal();
        }
        return;
      }
      this.nationId = selectedNation.idInSmartContract;
      // Creating the socket-client instance will automatically connect to the server.
      this.connection = SocketIOClient(config.CHAT_URL, {
        transports: ["websocket"],
        upgrade: false,
        query: `token=${config.AUTH_TOKEN}`
      });
      this.connection.on("connect", () => {
        this.connection.emit("room:join", {
          nation_id: this.nationId,
        });
      });

      this.state = {
        messages: [],
        joined: false
      };
    } else {
      // add initial bot message
      this.state = {
        messages: [
          {
github Bit-Nation / BITNATION-Pangea-mobile / src / screens / ChatScreen / index.js View on Github external
componentDidMount() {
    if (this.props.isBot !== true && this.connection) {
      this.props.showSpinner();
      // load initial messages
      const URL = `${config.CHAT_URL}/messages/${this.nationId}?auth_token=${config.AUTH_TOKEN}`;
      fetch(URL)
        .then(response => response.json())
        .then(
          (json) => {
            const messages = deprecatedCreateGiftedChatMessageObject(json.reverse());
            this.props.hideSpinner();
            this.setState(previousState => ({
              messages: GiftedChat.append(previousState.messages, messages),
            }));
          },
          () => {
            this.props.hideSpinner();
          },
        );

      // add socket listener
github Bit-Nation / BITNATION-Pangea-mobile / src / screens / ChatScreen / index.js View on Github external
componentDidMount() {
    // TODO: Does chat migration apply to here as well?
    if (this.props.isBot !== true && this.connection) {
      this.props.showSpinner();
      // load initial messages
      const URL = `${config.CHAT_URL}/messages/${this.nationId}?auth_token=${config.AUTH_TOKEN}`;
      fetch(URL)
        .then(response => response.json())
        .then(
          (json) => {
            const messages = createGiftedChatMessageObject(json.reverse());
            this.props.hideSpinner();
            this.setState(previousState => ({
              messages: GiftedChat.append(previousState.messages, messages),
            }));
          },
          () => {
            this.props.hideSpinner();
          },
        );

      // add socket listener
github CodingItWrong / react-native-tdd-livestream / src / store / api / remote.js View on Github external
import env from 'react-native-config';
import axios from 'axios';

const api = axios.create({
  baseURL: env.API_URL,
  headers: {
    'Authorization':
    `Bearer ${env.AUTH_TOKEN}`,
    'Content-Type': 'application/vnd.api+json',
  },
});

export default api;