Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
handleSubmit() {
API.post("treehacks", '/review/rate', {
body: {
"application_id": this.state.application_data.user.id,
...this.state.reviewFormData
}
}).then((data) => {
if (data.results.status === "success") {
this.nextApplication();
}
}).catch(err => {
alert("Error, " + err);
console.error(err);
})
}
}
handleSubmit() {
API.post("treehacks", '/judging/rate', {
body: {
"hack_id": this.state.hack_data._id,
...this.state.reviewFormData
}
}).then((data) => {
if (data.results.status === "success") {
this.nextApplication();
}
}).catch(err => {
alert("Error, " + err);
console.error(err);
})
}
}
let csvData = null;
const opts = { header: true, skipEmptyLines: true };
if (status === STATUS.ADMITTED) {
csvData = Papa.parse(headersAdmitted.join(",") + "\n" + ids, opts).data;
}
else {
csvData = Papa.parse(headers.join(",") + "\n" + ids, opts).data;
}
for (let item of csvData) {
if (item.__parsed_extra) {
alert("Error: Too many fields are in a line. Please reformat the data.");
return;
}
}
dispatch(loadingStart());
return API.post("treehacks", `/users_bulkchange`, {
body: {
ids: csvData,
status: status
}
}).then(e => {
dispatch(setBulkChangeIds(""));
dispatch(setBulkChangeStatus(""));
dispatch(loadingEnd());
}).catch(e => {
console.error(e);
dispatch(loadingEnd());
alert("Error performing bulk change: " + e);
});
}
export const declineAdmission = () => (dispatch, getState) => {
const userId = (getState().auth as IAuthState).userId;
dispatch(loadingStart());
return API.post("treehacks", `/users/${userId}/status/decline`, {}).then(e => {
dispatch(getUserProfile());
}).catch(e => {
console.error(e);
dispatch(loadingEnd());
alert("Error " + e);
});
}
skipHack() {
if (!window.confirm(`Are you sure? This will mark table ${this.state.hack_data._id} as NOT HERE.`)) {
return;
}
return API.post("treehacks", '/judging/rate', {
body: {
"hack_id": this.state.hack_data._id,
"skip_hack": true
}
}).then((data) => {
if (data.results.status === "success") {
this.nextApplication();
}
}).catch(err => {
alert("Error, " + err);
console.error(err);
})
}
nextApplication(id?: string) {
saveGoal = () => {
const { goal } = this.state;
return API.post("goals", "/goals", {
body: {
title: goal.title,
content: goal.content
}
}).then((value: any) => {
this.setState({
isUpdating: false,
redirect: '/'
});
});
}
onReserve(id, e) {
e.preventDefault();
API.post("treehacks", `/rooms`, { body: { room: id } })
.then(this._updateFromApi)
.catch(e => alert(`Couldn't reserve room: ${e.response.data.message}`));
}