get-token.js 677 B

1234567891011121314
  1. // let getToken = 'Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJkYXRhc2NvcGUiOiIxIiwiZXhwIjoxNzI3MzQ0MzQ1LCJpZGVudGl0eSI6OSwibmljZSI6ImxpdWoiLCJvcmlnX2lhdCI6MTcyNzM0MDc0NSwicm9sZWlkIjoxLCJyb2xla2V5IjoiYWRtaW4iLCJyb2xlbmFtZSI6Iuezu-e7n-euoeeQhuWRmCJ9.n1CTya_M5Cc07y9cZ96G_EFIrzo1tpHVIrtqxx1Vg98'
  2. let getToken = ''
  3. function getCookie () {
  4. const cookies = document && document.cookie && document.cookie.split(';');
  5. if (cookies) {
  6. const tempData = cookies.find(cookie => cookie.trim().startsWith('Admin-Token='))
  7. if (tempData) {
  8. const sharedData = tempData.split('=')[1];
  9. getToken= 'Bearer ' + sharedData
  10. }
  11. }
  12. }
  13. getCookie()
  14. export default getToken