logo

mastofe

My custom branche(s) on git.pleroma.social/pleroma/mastofe git clone https://hacktivis.me/git/mastofe.git

api.js (529B)


  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: getState ? {
  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. });