You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

26 lines
513 B

  1. import axios from 'axios';
  2. import LinkHeader from './link_header';
  3. export const getLinks = response => {
  4. const value = response.headers.link;
  5. if (!value) {
  6. return { refs: [] };
  7. }
  8. return LinkHeader.parse(value);
  9. };
  10. export default getState => axios.create({
  11. headers: {
  12. 'Authorization': `Bearer ${getState().getIn(['meta', 'access_token'], '')}`,
  13. },
  14. transformResponse: [function (data) {
  15. try {
  16. return JSON.parse(data);
  17. } catch(Exception) {
  18. return data;
  19. }
  20. }],
  21. });