How to use the topcoder-react-lib.services.api function in topcoder-react-lib

To help you get started, we’ve selected a few topcoder-react-lib 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 topcoder-platform / community-app / src / shared / components / tc-communities / communities / srmx / Home / index.jsx View on Github external
*
 * It hardcodes data which is passed to dummy components,
 * thus we disable max-len eslint rule for this file
 */
/* eslint-disable max-len */

import React from 'react';
import Section from 'components/tc-communities/Section';
import PT from 'prop-types';
import LoadingIndicator from 'components/LoadingIndicator';

import { services } from 'topcoder-react-lib';

import style from './style.scss';

const { getApi } = services.api;
const INFO_ID = '30058834';

/**
 * NOTE: There is some reason to turn this component into container. This is
 * a temporary hacky solution of one particular problem, do not take it as an
 * example, and just ignore the fact that it is located under components
 * section of the app code. It is a temporary exception.
 */
export default class Home extends React.Component {
  constructor(props) {
    super(props);
    this.state = {
      msgHtml: '',
    };
  }
github topcoder-platform / community-app / src / shared / services / memberCert.js View on Github external
/**
 * This module provides a service for convenient manipulation with Topcoder
 * membership via TC API.
 */

import { services } from 'topcoder-react-lib';

const { getApi } = services.api;

class MemberCertService {
  /**
   * @param {String} tokenV3 Optional. Auth token for Topcoder API v3.
   */
  constructor(tokenV3) {
    this.private = {
      api: getApi('V3', tokenV3),
      tokenV3,
    };
  }

  /**
   * check user has registered a program or not
   * @param  {string} userId    user's id
   * @param  {string} programId program's id
github topcoder-platform / community-app / src / server / services / submissions.js View on Github external
async function getApi() {
  const token = await getM2MToken();
  return services.api.getApi('V5', token);
}