UNPKG

adastra-ui-comment

Version:

Testing locally 1) in this file - `npm i` install dependencies - `npm run build` or `npm run tsc` to build your module 2) in childApp - in package.json under dependencies add ui-astra-assets with file:(relativePathToRepo) - "ui-astra-a

43 lines 1.4 kB
import axios from 'axios'; export const getError = (e, actionType) => { return { type: actionType, data: e, }; }; export const get = (url) => { const authToken = getAuthToken(); return axios.get(url, { headers: { Accept: 'application/json', 'Content-Type': 'application/json', Authorization: `Bearer ${authToken}`, }, }).then(response => (response.data)); }; export const post = (url, body) => { const authToken = getAuthToken(); return axios.post(url, body, { headers: { Accept: 'application/json', 'Content-Type': 'application/json', Authorization: `Bearer ${authToken}`, }, }).then(response => (response.data)); }; export const deleteResource = (url) => { const authToken = getAuthToken(); return axios.delete(url, { headers: { Accept: 'application/json', 'Content-Type': 'application/json', Authorization: `Bearer ${authToken}`, }, }).then(response => (response.data)); }; export const responseToJson = (response) => { return JSON.parse(response); }; export const getAuthToken = () => { const tokenItem = localStorage.getItem('aws-amplify-cacheCognitoOpenIDToken') || '{ "data": "" }'; return JSON.parse(tokenItem).data; }; //# sourceMappingURL=actionUtilities.js.map