mirror of
https://github.com/scratchfoundation/scratch-www.git
synced 2025-03-23 19:30:34 -04:00
Use the proper API route for reporting projects
This commit is contained in:
parent
24d07f6139
commit
85f13935b3
2 changed files with 9 additions and 8 deletions
src
|
@ -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));
|
||||
|
|
Loading…
Add table
Reference in a new issue