From 975a9c964555523616055e6287a46ccfc16e6a1c Mon Sep 17 00:00:00 2001 From: Ben Wheeler Date: Tue, 28 May 2019 15:11:17 -0400 Subject: [PATCH] omit token if null or falsy --- src/redux/preview.js | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/redux/preview.js b/src/redux/preview.js index 4fbf21241..239a4a93e 100644 --- a/src/redux/preview.js +++ b/src/redux/preview.js @@ -763,12 +763,16 @@ module.exports.getRemixes = id => (dispatch => { }); }); + module.exports.getProjectStudios = (id, ownerUsername, isAdmin, token) => (dispatch => { dispatch(module.exports.setFetchStatus('projectStudios', module.exports.Status.FETCHING)); - api({ - uri: `${isAdmin ? '/admin' : `/users/${ownerUsername}`}/projects/${id}/studios`, - authentication: token - }, (err, body, res) => { + const opts = { + uri: `${isAdmin ? '/admin' : `/users/${ownerUsername}`}/projects/${id}/studios` + }; + if (token) { + Object.assign(opts, {authentication: token}); + } + api(opts, (err, body, res) => { if (err) { dispatch(module.exports.setFetchStatus('projectStudios', module.exports.Status.ERROR)); dispatch(module.exports.setError(err));