about summary refs log tree commit diff
path: root/app/assets/javascripts/components/api.jsx
blob: f674290ab6398d4a9183dd909fde951f77d02431 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
import axios from 'axios';
import LinkHeader from 'http-link-header';

export const getLinks = response => {
  return LinkHeader.parse(response.headers.link);
};

export default getState => axios.create({
  headers: {
    'Authorization': `Bearer ${getState().getIn(['meta', 'access_token'], '')}`
  },

  transformResponse: [function (data) {
    return JSON.parse(data);
  }]
});