How to use the axios.get function in axios

To help you get started, weโ€™ve selected a few axios 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 pintowar / opta-invest / client / src / pages / portfolio / index.vue View on Github external
mounted () {
    axios.get('/api/portfolios').then(res => {
      this.items = res.data.map(e => ({id: e.id, name: e.name}))
    }, error => {
      console.error(error)
    })
  }
}
github codenesium / samples / StackOverflow / StackOverflow.Api.TypeScript / src / react / src / components / shared / linkTypeTable.tsx View on Github external
loadRecords() {
    this.setState({ ...this.state, loading: true });

    axios
      .get(this.props.apiRoute, {
        headers: {
          'Content-Type': 'application/json',
        },
      })
      .then(
        resp => {
          let response = resp.data as Array;

          console.log(response);

          let mapper = new LinkTypeMapper();

          let linkTypes: Array = [];

          response.forEach(x => {
github codenesium / samples / StudioResourceManager / StudioResourceManager.Api.TypeScript / src / react / src / components / spaceSpaceFeature / spaceSpaceFeatureSearchForm.tsx View on Github external
loadRecords(query: string = '') {
    this.setState({ ...this.state, searchValue: query });
    let searchEndpoint =
      Constants.ApiEndpoint + ApiRoutes.SpaceSpaceFeatures + '?limit=100';

    if (query) {
      searchEndpoint += '&query=' + query;
    }

    axios
      .get>(searchEndpoint, {
        headers: GlobalUtilities.defaultHeaders(),
      })
      .then(response => {
        let viewModels: Array = [];
        let mapper = new SpaceSpaceFeatureMapper();

        response.data.forEach(x => {
          viewModels.push(mapper.mapApiResponseToViewModel(x));
        });

        this.setState({
          records: viewModels,
          filteredRecords: viewModels,
          loading: false,
          loaded: true,
github datafornews / metada / react / src / components / Home / Content / Profile / RegisterForm.js View on Github external
asyncCheckEmail = (email) => {
        return Axios.get('http://localhost:5000/email_exists/' + email)
    }
github lesspass / lesspass / src / services / auth.js View on Github external
getUser() {
    const config = this.getRequestConfig();
    return axios.get('/api/auth/me/', config).then(response => {
      Object.assign(this.user, response.data);
      return this.user;
    });
  },
  register(user) {
github metasfresh / metasfresh-webui-frontend / src / actions / AppActions.js View on Github external
export function getKPIData(id) {
  return axios.get(
    `${config.API_URL}/dashboard/kpis/${id}/data?silentError=true`
  );
}
github Uintra / Uintra / src / Compent.uIntra / App_Plugins / Core / Content / scripts / Ajax.js View on Github external
    get: url => axios.get(url, config),
    post: (url, data) => axios.post(url, data, config),
github Wildhoney / Standalone / example / packages / mars-weather / component.js View on Github external
const componentWillMount = function componentWillMount() {

    get('/weather').then(response => {
        this.setState({ weather: camelizeKeys(response.data).report });
    });

};
github polonel / trudesk / src / client / api / index.js View on Github external
api.settings.hasMongoDBTools = () => {
  return axios.get('/api/v1/backup/hastools').then(res => {
    return res.data
  })
}
api.settings.fetchBackups = () => {
github codenesium / samples / CAD / CAD.Api.TypeScript / src / react / src / components / vehicleCapabilities / vehicleCapabilitiesSearchForm.tsx View on Github external
loadRecords(query: string = '') {
    this.setState({ ...this.state, searchValue: query });
    let searchEndpoint =
      Constants.ApiEndpoint + ApiRoutes.VehicleCapabilities + '?limit=100';

    if (query) {
      searchEndpoint += '&query=' + query;
    }

    axios
      .get>(searchEndpoint, {
        headers: GlobalUtilities.defaultHeaders(),
      })
      .then(response => {
        let viewModels: Array = [];
        let mapper = new VehicleCapabilitiesMapper();

        response.data.forEach(x => {
          viewModels.push(mapper.mapApiResponseToViewModel(x));
        });

        this.setState({
          records: viewModels,
          filteredRecords: viewModels,
          loading: false,
          loaded: true,