コード例 #1
0
ファイル: Story.js プロジェクト: techmsi/madlib-app
 _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);
     });
 }
コード例 #2
0
 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});
     }
 }
コード例 #3
0
ファイル: Targets.js プロジェクト: waffle-iron/echo-sense
 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});
   });
 }
コード例 #4
0
ファイル: Reports.js プロジェクト: ArnoldOchieng/echo-sense
 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});
   });
 },
コード例 #5
0
ファイル: Sensors.js プロジェクト: ArnoldOchieng/echo-sense
 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});
   });
 }
コード例 #6
0
ファイル: NewItem.js プロジェクト: josephluck/cmsfrontend
	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})
	  });
	}
コード例 #7
0
	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");
		})
	}
コード例 #8
0
ファイル: Item.js プロジェクト: josephluck/cmsfrontend
	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})
		})
	}
コード例 #9
0
ファイル: Template.js プロジェクト: josephluck/cmsfrontend
	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})
		})
	}
コード例 #10
0
ファイル: Section.js プロジェクト: josephluck/cmsfrontend
	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})
		})
	}
コード例 #11
0
 fetch_from_pocket() {
   api.get("/api/integrations/pocket", {}, (res) => {
     this.merge_readables(res.readables);
   });
 }
コード例 #12
0
 fetch_from_goodreads() {
   api.get("/api/integrations/goodreads", {}, (res) => {
     this.merge_readables(res.readables);
   });
 }
コード例 #13
0
 fetch_readables() {
   api.get("/api/readable", {unread: 1}, (res) => {
     this.merge_readables(res.readables);
   });
 }
コード例 #14
0
	fetchTask(id) {
	    api.get(`/api/processtask/${id}`, {}, (res) => {
	    	this.dispatch(res);
	    });
	}
コード例 #15
0
ファイル: index.js プロジェクト: starandtina/wetennis
 promise: () => API.get(`${URL.times}?currentPage=${currentPage}&id=${id}`),
コード例 #16
0
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
コード例 #17
0
	fetchTasks() {
	    api.get("/api/processtask", {}, (res) => {
	    	this.dispatch(res);
	    });
	}