mirror of
https://github.com/scratchfoundation/scratch-www.git
synced 2024-11-23 07:38:07 -05:00
omit token if null or falsy
This commit is contained in:
parent
5a24e9d7d6
commit
975a9c9645
1 changed files with 8 additions and 4 deletions
|
@ -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));
|
||||
|
|
Loading…
Reference in a new issue