How to use the @aws-amplify/api.get function in @aws-amplify/api

To help you get started, we’ve selected a few @aws-amplify/api 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 TreeHacks / root / src / Judge / Judge.tsx View on Github external
nextApplication(id?: string) {
		Promise.all([
			API.get("treehacks", '/judging/next_hack', { queryStringParameters: id ? { hack_id: id } : {} }),
			// API.get("treehacks", '/judging/stats', {})
		]).then(([hack_data]) => {
			window.scrollTo(0, 0);
			this.setState({ hack_data, reviewFormData: null });
		}).catch((err) => {
			alert("Error, " + err);
			console.log(err);
		});
	}
github TreeHacks / root / src / Review / Review.tsx View on Github external
nextApplication() {
		Promise.all([
			API.get("treehacks", '/review/leaderboard', {}),
			API.get("treehacks", '/review/next_application', {}),
			API.get("treehacks", '/review/stats', {})
		]).then(([leaderboard_data, application_data, stats_data]) => {
			window.scrollTo(0, 0);
			this.setState({ leaderboard_data, application_data, stats_data, reviewFormData: null });
		}).catch((err) => {
			alert("Error, " + err);
			console.log(err);
		});
	}
	getSortedLeaderboardByRecent(leaderboard) {
github TreeHacks / root / src / Review / Review.tsx View on Github external
nextApplication() {
		Promise.all([
			API.get("treehacks", '/review/leaderboard', {}),
			API.get("treehacks", '/review/next_application', {}),
			API.get("treehacks", '/review/stats', {})
		]).then(([leaderboard_data, application_data, stats_data]) => {
			window.scrollTo(0, 0);
			this.setState({ leaderboard_data, application_data, stats_data, reviewFormData: null });
		}).catch((err) => {
			alert("Error, " + err);
			console.log(err);
		});
	}
	getSortedLeaderboardByRecent(leaderboard) {
github TreeHacks / root / src / Admin / JudgeLeaderboard.tsx View on Github external
async loadData() {
        this.setState({ refreshing: true });

        Promise.all([
            API.get("treehacks", '/judging/leaderboard', {}),
            API.get("treehacks", '/judging/stats', {})
        ]).then(([leaderboard_data, stats_data]) => {
            window.scrollTo(0, 0);
            this.setState({ leaderboard_data, stats_data, refreshing: false });
        }).catch((err) => {
            alert("Error, " + err);
            this.setState({ refreshing: false });
            console.log(err);
        });
    }
    render() {
github TreeHacks / root / src / Review / Review.tsx View on Github external
nextApplication() {
		Promise.all([
			API.get("treehacks", '/review/leaderboard', {}),
			API.get("treehacks", '/review/next_application', {}),
			API.get("treehacks", '/review/stats', {})
		]).then(([leaderboard_data, application_data, stats_data]) => {
			window.scrollTo(0, 0);
			this.setState({ leaderboard_data, application_data, stats_data, reviewFormData: null });
		}).catch((err) => {
			alert("Error, " + err);
			console.log(err);
		});
	}
	getSortedLeaderboardByRecent(leaderboard) {
github TreeHacks / root / src / Rooms / Rooms.tsx View on Github external
refresh() {
    API.get("treehacks", `/rooms`, {})
      .then(this._updateFromApi)
      .catch(e => alert(`Couldn't fetch rooms: ${e.response.data.message}`));
  }
github awslabs / aws-full-stack-template / assets / src / modules / goal / AddEditGoal.tsx View on Github external
getGoal(goalId: string) {
    this.setState({
      isLoading: true,
    });

    return API.get("goals", `/goals/${goalId}`, null).then((value: any) => {
      this.setState({
        isLoading: false,
        goal: {
          title: value.title,
          content: value.content,
          goalId: this.props.match.params.id,
        }
      });
    });
  }