Commit 85f13935 authored by Paul Kaplan's avatar Paul Kaplan

Use the proper API route for reporting projects

parent 24d07f61
......@@ -660,7 +660,7 @@ module.exports.reportComment = (projectId, commentId, topLevelCommentId, token)
});
});
module.exports.reportProject = (id, jsonData) => (dispatch => {
module.exports.reportProject = (id, jsonData, token) => (dispatch => {
dispatch(module.exports.setFetchStatus('report', module.exports.Status.FETCHING));
// scratchr2 will fail if no thumbnail base64 string provided. We don't yet have
// a way to get the actual project thumbnail in www/gui, so for now just submit
......@@ -670,11 +670,12 @@ module.exports.reportProject = (id, jsonData) => (dispatch => {
'0lEQVR42mP8/x8AAwMCAO+ip1sAAAAASUVORK5CYII='
});
api({
host: '',
uri: `/site-api/projects/all/${id}/report/`,
uri: `/proxy/projects/${id}/report`,
authentication: token,
withCredentials: true,
method: 'POST',
json: jsonData,
useCsrf: true
useCsrf: true,
json: jsonData
}, (err, body, res) => {
if (err || res.statusCode !== 200) {
dispatch(module.exports.setFetchStatus('report', module.exports.Status.ERROR));
......
......@@ -199,7 +199,7 @@ class Preview extends React.Component {
this.setState({addToStudioOpen: false});
}
handleReportSubmit (formData) {
this.props.reportProject(this.state.projectId, formData);
this.props.reportProject(this.state.projectId, formData, this.props.user.token);
}
handlePopState () {
const path = window.location.pathname.toLowerCase();
......@@ -612,8 +612,8 @@ const mapDispatchToProps = dispatch => ({
setLovedStatus: (loved, id, username, token) => {
dispatch(previewActions.setLovedStatus(loved, id, username, token));
},
reportProject: (id, formData) => {
dispatch(previewActions.reportProject(id, formData));
reportProject: (id, formData, token) => {
dispatch(previewActions.reportProject(id, formData, token));
},
setOriginalInfo: info => {
dispatch(previewActions.setOriginalInfo(info));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment