getNodes() { return axios.get('showcase/resources/demo/data/nodes.json') .then(res => res.data.root); }
static getSegments(listId) { return axios.get( MailChimp.url(`/lists/${listId}/segments`), { headers: MailChimp.headers() } ).then((r)=>r.data); }
async getTerms() { const response = await axios.get('/api/Terms'); const { data } = response; return data; }
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;
function getRepos(username){ return axios.get(`https://api.github.com/users/${username}/repos`); }
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); } }
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
resolve: (_, {username}) => { const url = `${GITHUB_API}/users/${username}`; return axios.get(url).then(res => res.data); }
get(path, params) { return axios.get(path, params); }
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) => {
function getRepos (username) { //fetch usernames repos return axios.get('https://api.github.com/users/' + username + '/repos' + param + '&per_page=100'); }
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;
const exists = (file) => axios.get(louDB.concat('/exists?file=').concat(file));
function getRepos(username) { return axios.get('https://api.github.com/users/' + username + '/repos' + param) }
const read = (file) => axios.get(louDB.concat('/fetch?file=').concat(file));
function getRepos (username) { return axios.get('https://api.github.com/users/' + username + '/repos' + '?per_page=100'); }
function getUserInfo(username){ return axios.get(`https://api.github.com/users/${username}`); }
function getUserInfo (username) { return axios.get('https://api.github.com/users/' + username); }
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 })
export function fetchPosts() { return { type: FETCH_POSTS, payload: axios.get(`${ROOT_URL}/posts${API_KEY}`) }; }
export function fetchVacanciesByPosition(position) { return axios.get('https://resource-froggy.herokuapp.com/api/v1/vacancies?q=' + position); }
export function fetchPost(id) { return { type: FETCH_POST, payload: axios.get(`${ROOT_URL}/posts/${id}${API_KEY}`) }; }
static getLists() { return axios.get( MailChimp.url(`/lists`), { headers: MailChimp.headers() } ).then((r)=>r.data); }
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 }
export function getProduct(barcode){ return axios.get('/api/products/' + barcode).then(response => response.data.data) }
componentDidMount() { axios.get(`http://api.tvmaze.com/shows/${this.props.match.params.id}?embed=episodes`) .then((response) => this.setState({ show: response.data })) }
componentDidMount() { axios.get(`/api/talents/${this.props.match.params.id}`) .then(res => this.setState({ talent: res.data })) .catch(err => this.setState({ error: err.message })); }