_loadData () { // get from server this.api.get('/story') .then(data => { this._setupParser(data.story); this.setState({ data: data.story }); }).catch(e => { console.log('Error', e); }); }
return function(dispatch) { try { api.get("/api/auth/logout", {}, (res) => { dispatch({ success: res.success }); }); } catch (err) { console.error(err); dispatch({ok: false, error: err.data}); } }
fetchTargets() { var that = this; this.setState({loading: true}); var data = { }; api.get("/api/target", data, function(res) { if (res.success) { that.setState({targets: res.data.targets, loading: false }); } else that.setState({loading: false}); }); }
fetchReports: function() { var that = this; this.setState({loading: true}); var data = { }; api.get("/api/report", data, function(res) { if (res.success) { var reports = res.data.reports; that.setState({reports: reports, loading: false }); } else that.setState({loading: false}); }); },
fetchSensors() { var that = this; this.setState({loading: true}); var data = { }; api.get("/api/sensor", data, function(res) { if (res.success) { var sensors = res.data.sensors; that.setState({sensors: sensors, loading: false }); } else that.setState({loading: false}); }); }
componentWillMount() { Store.get().set({templates_loading: true}) Api.get({ url: { name: 'templates' } }).then((body) => { Store.get().templates.reset(body); Store.get().set({templates_loading: false}) }, (err) => { Store.get().templates.reset([]); Store.get().set({templates_loading: false}) }); }
constructor(props) { super(props); let confirmation_token = props.location.query.confirmation_token; Api.get({ url: { name: 'confirm_account', confirmation_token: confirmation_token } }).then((body) => { Api.redirect("/login"); }, (err) => { alert("Error confirming user") Api.redirect("/login"); }) }
componentWillMount() { Api.get({ url: { name: 'item', item_id: this.props.params.item_id } }).then((body) => { Store.get().item.reset(body); Store.get().set({item_loading: false}) }, (err) => { Store.get().item.reset({ fields: [] }); Store.get().set({item_loading: false}) }) }
componentWillMount() { Api.get({ url: { name: 'template', template_id: this.props.params.template_id } }).then((body) => { Store.get().template.reset(body); Store.get().set({template_loading: false}) }, (err) => { Store.get().template.reset({ attributes: [] }); Store.get().set({template_loading: false}) }) }
componentWillMount() { Api.get({ url: { name: 'section', id: this.props.params.id, section_id: this.props.params.section_id } }).then((body) => { Store.get().section.reset(body); Store.get().set({section_loading: false}) }, (err) => { Store.get().section.reset({ items: [] }); Store.get().set({section_loading: false}) }) }
fetch_from_pocket() { api.get("/api/integrations/pocket", {}, (res) => { this.merge_readables(res.readables); }); }
fetch_from_goodreads() { api.get("/api/integrations/goodreads", {}, (res) => { this.merge_readables(res.readables); }); }
fetch_readables() { api.get("/api/readable", {unread: 1}, (res) => { this.merge_readables(res.readables); }); }
fetchTask(id) { api.get(`/api/processtask/${id}`, {}, (res) => { this.dispatch(res); }); }
promise: () => API.get(`${URL.times}?currentPage=${currentPage}&id=${id}`),
var ProjectActions = require('actions/ProjectActions'); var api = require('utils/api'); import {findIndexById} from 'utils/store-utils'; const _PROJECT_API_URL = '/api/project'; const _construct_api_url = (url_part) => `${_PROJECT_API_URL}/${url_part}`; const ProjectSource = { fetchProjects: { remote(state) { return api.get("/api/project/active", {}) }, // this function checks in our local cache first // if the value is present it'll use that instead (optional). local(state) { if (state.loaded) { return state.projects } }, // here we setup some actions to handle our response loading: ProjectActions.fetchingProjects, // (optional) success: ProjectActions.gotProjects, // (required) error: ProjectActions.fetchingProjectsFailed, // (required) // shouldFetch(state) { // return true
fetchTasks() { api.get("/api/processtask", {}, (res) => { this.dispatch(res); }); }