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.
27 lines
511 B
27 lines
511 B
8 years ago
|
import axios from 'axios';
|
||
8 years ago
|
import LinkHeader from './link_header';
|
||
8 years ago
|
|
||
|
export const getLinks = response => {
|
||
8 years ago
|
const value = response.headers.link;
|
||
|
|
||
|
if (!value) {
|
||
|
return { refs: [] };
|
||
|
}
|
||
|
|
||
|
return LinkHeader.parse(value);
|
||
8 years ago
|
};
|
||
8 years ago
|
|
||
|
export default getState => axios.create({
|
||
|
headers: {
|
||
|
'Authorization': `Bearer ${getState().getIn(['meta', 'access_token'], '')}`
|
||
|
},
|
||
|
|
||
|
transformResponse: [function (data) {
|
||
8 years ago
|
try {
|
||
|
return JSON.parse(data);
|
||
|
} catch(Exception) {
|
||
|
return data;
|
||
|
}
|
||
8 years ago
|
}]
|
||
|
});
|