Restore vanilla components
This commit is contained in:
parent
45c44989c8
commit
e19fc6a9f8
272 changed files with 27052 additions and 20 deletions
26
app/javascript/mastodon/api.js
Normal file
26
app/javascript/mastodon/api.js
Normal file
|
@ -0,0 +1,26 @@
|
|||
import axios from 'axios';
|
||||
import LinkHeader from './link_header';
|
||||
|
||||
export const getLinks = response => {
|
||||
const value = response.headers.link;
|
||||
|
||||
if (!value) {
|
||||
return { refs: [] };
|
||||
}
|
||||
|
||||
return LinkHeader.parse(value);
|
||||
};
|
||||
|
||||
export default getState => axios.create({
|
||||
headers: {
|
||||
'Authorization': `Bearer ${getState().getIn(['meta', 'access_token'], '')}`,
|
||||
},
|
||||
|
||||
transformResponse: [function (data) {
|
||||
try {
|
||||
return JSON.parse(data);
|
||||
} catch(Exception) {
|
||||
return data;
|
||||
}
|
||||
}],
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue