Prepare apiService for base url.

This commit is contained in:
Roger Braun 2016-11-22 15:45:40 +01:00
parent 2147807fa0
commit fd4cd6d687
1 changed files with 6 additions and 0 deletions

View File

@ -15,6 +15,12 @@ const MEDIA_UPLOAD_URL = '/api/statusnet/media/upload'
// import { param, ajax } from 'jquery'; // import { param, ajax } from 'jquery';
// import { merge } from 'lodash'; // import { merge } from 'lodash';
let fetch = (url, options) => {
const baseUrl = ''
const fullUrl = baseUrl + url
return window.fetch(fullUrl, options)
}
const authHeaders = (user) => { const authHeaders = (user) => {
if (user) { if (user) {
return { 'Authorization': `Basic ${btoa(`${user.username}:${user.password}`)}` } return { 'Authorization': `Basic ${btoa(`${user.username}:${user.password}`)}` }