]> cat aescling's git repositories - mastodon.git/blob - app/javascript/themes/glitch/util/api.js
Forking glitch theme
[mastodon.git] / app / javascript / themes / glitch / util / api.js
1 import axios from 'axios';
2 import LinkHeader from './link_header';
3
4 export const getLinks = response => {
5 const value = response.headers.link;
6
7 if (!value) {
8 return { refs: [] };
9 }
10
11 return LinkHeader.parse(value);
12 };
13
14 export default getState => axios.create({
15 headers: {
16 'Authorization': `Bearer ${getState().getIn(['meta', 'access_token'], '')}`,
17 },
18
19 transformResponse: [function (data) {
20 try {
21 return JSON.parse(data);
22 } catch(Exception) {
23 return data;
24 }
25 }],
26 });
This page took 0.07537 seconds and 4 git commands to generate.