Пример #1
0
 getNodes() {
     return axios.get('showcase/resources/demo/data/nodes.json')
             .then(res => res.data.root);
 }
Пример #2
0
 static getSegments(listId) {
   return axios.get(
     MailChimp.url(`/lists/${listId}/segments`),
     { headers: MailChimp.headers() }
   ).then((r)=>r.data);
 }
Пример #3
0
 async getTerms() {
   const response = await axios.get('/api/Terms');
   const { data } = response;
   return data;
 }
Пример #4
0
export function fetchVacancies() {
  return axios.get('https://resource-froggy.herokuapp.com/api/v1/vacancies');
}
import UsersActions from '../actions/UsersActions';
import http from 'axios';

const UsersSource = {
  fetchUsers: {
    remote() {
        return http.get('http://localhost:5000/api/users')
          .then((res) => {
            return res.data;
          })
          .catch((err) => {
            return Promise.reject(err.data);
          });
    },

    local() {
      return null;
    },

    success: UsersActions.updateUsers,
    error: UsersActions.usersFailed,
    loading: UsersActions.fetchUsers

  }
}

module.exports = UsersSource;
Пример #6
0
function getRepos(username){
    return axios.get(`https://api.github.com/users/${username}/repos`);
}
Пример #7
0
export default function (widget, projectId, url) {

  // DOM elements.
  const containerEl = document.querySelector('.thumbnails-container');
  const thumbnailsEl = document.querySelector('.thumbnail-items-container');
  const errorEl = document.querySelector('.error');
  const preloaderEl = document.querySelector('.preloader');
  const inputEl = document.getElementById('wistia-video-id');
  let activeThumbnailEl;

  widget.field.onValueChanged(onValueChanged);

  // Resize iframe in Contenful UI.
  widget.window.updateHeight();

  axios.get(url, {
      params: {
        project_id: projectId
      }
    })
    .then(response => {
      preloaderEl.style.display = 'none';
      containerEl.style.display = 'block';

      const ejsTemplate = require('ejs!./../templates/video-browser.ejs');

      thumbnailsEl.innerHTML = ejsTemplate({
        'data': response.data
      });

      // Pass value from Contentful to input element.
      inputEl.value = widget.field.getValue();

      const thumbnailEls = document.querySelectorAll('.thumbnail .btn');

      for (let i = 0; i < thumbnailEls.length; i++) {
        thumbnailEls[i].addEventListener('click', onThumbnailClick);
        if (inputEl.value && thumbnailEls[i].dataset.videoId == inputEl.value) {
          thumbnailEls[i].classList.add('active');
        }
      }
    })
    .catch(response => {
      preloaderEl.style.display = 'none';
      errorEl.style.display = 'block';
      console.error(response);
    });

  /**
   * Calls the callback every time the value of the field is changed by some external event
   * (e.g. when multiple editors are working on the same entry).
   * @param val The newly changed value.
   */
  function onValueChanged(val) {
    inputEl.value = val;
  }

  function onThumbnailClick(event) {
    if (activeThumbnailEl) {
      activeThumbnailEl.classList.remove('active');
    }
    event.currentTarget.classList.add('active');

    const embedId = event.currentTarget.dataset.videoId;

    // Show value in view.
    inputEl.value = embedId;

    activeThumbnailEl = event.currentTarget;

    widget.field.setValue(embedId);
  }
}
Пример #8
0
      if (maxItem == null || value > maxValue) {
        maxItem = item
        maxValue = value
      }
    })

    return maxItem
  },

  getDataDir() {
    const dir = path.join(process.env.HOME, '.config', 'packages')
    if (!fs.existsSync(dir)) fs.mkdirSync(dir)
    return dir
  },

  getImagesDir() {
    const imagesDir = path.join(Utils.getDataDir(), 'images')
    if (!fs.existsSync(imagesDir)) fs.mkdirSync(imagesDir)
    return imagesDir
  },

  download(url, outputFilename) {
    axios.get(url, { responseType: 'arraybuffer' }).then(response => {
      fs.writeFileSync(outputFilename, response.data)
    })
  }
}

module.exports = Utils
Пример #9
0
 resolve: (_, {username}) => {
     const url = `${GITHUB_API}/users/${username}`;
     return axios.get(url).then(res => res.data);
 }
Пример #10
0
 get(path, params) {
   return axios.get(path, params);
 }
Пример #11
0
 getCity(city) {
   return axios.get(`${this.domain}/${city}.json`);
 }
 .then(function() {
   return axios.get('https://api.spotify.com/v1/tracks?ids=' + spotifyIds.join(','))
 }).then((response) => {
Пример #13
0
function getRepos (username) {
  //fetch usernames repos
  return axios.get('https://api.github.com/users/' + username + '/repos' + param + '&per_page=100');
}
Пример #14
0
import request from 'axios';


const API = {
  requestInitialState() {
    return request.get('/application/initialState');
  },

  leaveRoom(roomName) {
    return request.get(`/application/leaveRoom?roomName=${roomName}`);
  },

  fetchMoreMessages(roomName, fromMessageId, count) {
    return request.get(`/application/getmessages?roomName=${roomName}&id=${fromMessageId}&limit=${count}&before=true`);
  },

  fetchMoreActiveRooms(limit, offset) {
    return request.get(`/application/getactiverooms?limit=${limit}&offset=${offset}`);
  }
};

export default API;
Пример #15
0
const exists = (file) => axios.get(louDB.concat('/exists?file=').concat(file));
Пример #16
0
function getRepos(username) {
  return axios.get('https://api.github.com/users/' + username + '/repos' + param)
}
Пример #17
0
const read = (file) => axios.get(louDB.concat('/fetch?file=').concat(file));
Пример #18
0
function getRepos (username) {
  return axios.get('https://api.github.com/users/' + username + '/repos' + '?per_page=100');
}
Пример #19
0
function getUserInfo(username){
    return axios.get(`https://api.github.com/users/${username}`);
}
Пример #20
0
function getUserInfo (username) {
  return axios.get('https://api.github.com/users/' + username);
}
Пример #21
0
    updateSensors(state, { sensors }) {
      state.sensors = sensors
    },
    updateProcessInfo(state, { processInfo }) {
      state.processInfo = processInfo
    },
    proposeRecipe(state, { recipe }) {
      state.recipeCandidate = recipe
    },
    updateField(state, { field, value }) {
      state[field] = value
    }
  },
  actions: {
    async updateRecipes({ commit }) {
      const recipes = (await axios.get('/recipes')).data
      commit({
        type: 'updateRecipes',
        recipes
      })
    },
    async updateBrews({ commit }) {
      const response = await axios.get('/control/bews').catch(_.noop)

    },
    async updateSensors({ commit }) {
      const sensors = (await axios.get('/control/sensors')).data
      commit({
        type: 'updateSensors',
        sensors
      })
Пример #22
0
export function fetchPosts() {
  return {
    type: FETCH_POSTS,
    payload: axios.get(`${ROOT_URL}/posts${API_KEY}`)
  };
}
Пример #23
0
export function fetchVacanciesByPosition(position) {
  return axios.get('https://resource-froggy.herokuapp.com/api/v1/vacancies?q=' + position);
}
Пример #24
0
export function fetchPost(id) {
  return {
    type: FETCH_POST,
    payload: axios.get(`${ROOT_URL}/posts/${id}${API_KEY}`)
  };
}
Пример #25
0
 static getLists() {
   return axios.get(
     MailChimp.url(`/lists`),
     { headers: MailChimp.headers() }
   ).then((r)=>r.data);
 }
Пример #26
0
export function getProducts(){
    return axios.get('/api/products').then(response => response.data.data)
}
const getPage = async url => {
  logger('info', ['lib', 'get-articles', 'get-page', 'start', 'url', url])
  const { data } = await axios.get(url)
  return data
}
Пример #28
0
export function getProduct(barcode){
    return axios.get('/api/products/' + barcode).then(response => response.data.data)
}
Пример #29
0
 componentDidMount() {
     axios.get(`http://api.tvmaze.com/shows/${this.props.match.params.id}?embed=episodes`)
         .then((response) => this.setState({ show: response.data }))
 }
Пример #30
0
 componentDidMount() {
   axios.get(`/api/talents/${this.props.match.params.id}`)
     .then(res => this.setState({ talent: res.data }))
     .catch(err => this.setState({ error: err.message }));
 }