From 3bb2e91dbf740e77b25bc5256abfd7307a2bd04b Mon Sep 17 00:00:00 2001 From: Roger Braun Date: Sun, 6 Nov 2016 20:10:45 +0100 Subject: [PATCH] Return empty auth header when we don't have a user. --- src/services/api/api.service.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/services/api/api.service.js b/src/services/api/api.service.js index c9fcc4f6e4..9538517d65 100644 --- a/src/services/api/api.service.js +++ b/src/services/api/api.service.js @@ -14,7 +14,13 @@ const MEDIA_UPLOAD_URL = '/api/statusnet/media/upload' // import { param, ajax } from 'jquery'; // import { merge } from 'lodash'; -const authHeaders = (user) => ({ 'Authorization': `Basic ${btoa(`${user.username}:${user.password}`)}` }) +const authHeaders = (user) => { + if (user) { + return { 'Authorization': `Basic ${btoa(`${user.username}:${user.password}`)}` } + } else { + return { } + } +} const fetchTimeline = ({timeline, credentials, since = false, until = false}) => { const timelineUrls = {