Revert "Merge pull request #2858 from benjiwheeler/studios-for-project-endpoint"

This reverts commit a3902acfd1, reversing
changes made to 9e7a14cb76.
This commit is contained in:
Ben Wheeler 2019-04-04 15:04:46 -04:00
parent 8d38d7d4e5
commit c3002be4a6
2 changed files with 6 additions and 8 deletions

View file

@ -763,11 +763,10 @@ module.exports.getRemixes = id => (dispatch => {
}); });
}); });
module.exports.getProjectStudios = (id, ownerUsername, isAdmin, token) => (dispatch => { module.exports.getProjectStudios = id => (dispatch => {
dispatch(module.exports.setFetchStatus('projectStudios', module.exports.Status.FETCHING)); dispatch(module.exports.setFetchStatus('projectStudios', module.exports.Status.FETCHING));
api({ api({
uri: `${isAdmin ? '/admin' : `/users/${ownerUsername}`}/projects/${id}/studios`, uri: `/projects/${id}/studios`
authentication: token
}, (err, body, res) => { }, (err, body, res) => {
if (err) { if (err) {
dispatch(module.exports.setFetchStatus('projectStudios', module.exports.Status.ERROR)); dispatch(module.exports.setFetchStatus('projectStudios', module.exports.Status.ERROR));

View file

@ -159,10 +159,7 @@ class Preview extends React.Component {
if (typeof this.props.projectInfo.id === 'undefined') { if (typeof this.props.projectInfo.id === 'undefined') {
this.initCounts(0, 0); this.initCounts(0, 0);
} else { } else {
const token = this.props.user ? this.props.user.token : null;
this.initCounts(this.props.projectInfo.stats.favorites, this.props.projectInfo.stats.loves); this.initCounts(this.props.projectInfo.stats.favorites, this.props.projectInfo.stats.loves);
this.props.getProjectStudios(this.props.projectInfo.id,
this.props.authorUsername, this.props.isAdmin, token);
if (this.props.projectInfo.remix.parent !== null) { if (this.props.projectInfo.remix.parent !== null) {
this.props.getParentInfo(this.props.projectInfo.remix.parent); this.props.getParentInfo(this.props.projectInfo.remix.parent);
} }
@ -218,6 +215,7 @@ class Preview extends React.Component {
} }
this.props.getProjectInfo(this.state.projectId, token); this.props.getProjectInfo(this.state.projectId, token);
this.props.getRemixes(this.state.projectId, token); this.props.getRemixes(this.state.projectId, token);
this.props.getProjectStudios(this.state.projectId, token);
this.props.getCuratedStudios(username); this.props.getCuratedStudios(username);
this.props.getFavedStatus(this.state.projectId, username, token); this.props.getFavedStatus(this.state.projectId, username, token);
this.props.getLovedStatus(this.state.projectId, username, token); this.props.getLovedStatus(this.state.projectId, username, token);
@ -229,6 +227,7 @@ class Preview extends React.Component {
} }
this.props.getProjectInfo(this.state.projectId); this.props.getProjectInfo(this.state.projectId);
this.props.getRemixes(this.state.projectId); this.props.getRemixes(this.state.projectId);
this.props.getProjectStudios(this.state.projectId);
} }
} }
setScreenFromOrientation () { setScreenFromOrientation () {
@ -981,8 +980,8 @@ const mapDispatchToProps = dispatch => ({
getRemixes: id => { getRemixes: id => {
dispatch(previewActions.getRemixes(id)); dispatch(previewActions.getRemixes(id));
}, },
getProjectStudios: (id, ownerUsername, isAdmin, token) => { getProjectStudios: id => {
dispatch(previewActions.getProjectStudios(id, ownerUsername, isAdmin, token)); dispatch(previewActions.getProjectStudios(id));
}, },
getCuratedStudios: (username, token) => { getCuratedStudios: (username, token) => {
dispatch(previewActions.getCuratedStudios(username, token)); dispatch(previewActions.getCuratedStudios(username, token));