diff --git a/src/redux/preview.js b/src/redux/preview.js index 5d147ddb2..8b25aaf1c 100644 --- a/src/redux/preview.js +++ b/src/redux/preview.js @@ -53,7 +53,7 @@ module.exports.previewReducer = (state, action) => { case 'SET_PROJECT_INFO': return Object.assign({}, state, { projectInfo: action.info ? action.info : {}, - projectNotAvailable: !!action.info + projectNotAvailable: !action.info }); case 'SET_REMIXES': return Object.assign({}, state, { @@ -311,13 +311,13 @@ module.exports.getProjectInfo = (id, token) => (dispatch => { Object.assign(opts, {authentication: token}); } dispatch(module.exports.setFetchStatus('project', module.exports.Status.FETCHING)); - api(opts, (err, body) => { + api(opts, (err, body, response) => { if (err) { dispatch(module.exports.setFetchStatus('project', module.exports.Status.ERROR)); dispatch(module.exports.setError(err)); return; } - if (typeof body === 'undefined') { + if (typeof body === 'undefined' || response.statusCode === 404) { dispatch(module.exports.setFetchStatus('project', module.exports.Status.ERROR)); dispatch(module.exports.setError('No project info')); dispatch(module.exports.setProjectInfo(null));