Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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);
});
}
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) {
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) {
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() {
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) {
refresh() {
API.get("treehacks", `/rooms`, {})
.then(this._updateFromApi)
.catch(e => alert(`Couldn't fetch rooms: ${e.response.data.message}`));
}
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,
}
});
});
}
goals() {
return API.get("goals", "/goals", null);
}