Advertisement
kidto1412

header

Jun 30th, 2024 (edited)
875
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import util from '../tools/utility'
  2. import { AUTH_TOKEN_LOCAL } from 'src/constants/auth'
  3.  
  4. export default {
  5.   randomId(length: number) {
  6.     let result = ''
  7.     const characters =
  8.       '!?@#$%&*ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!?@#$%&*'
  9.     const charactersLength = characters.length
  10.     for (let i = 0; i < length; i++) {
  11.       result += characters.charAt(Math.floor(Math.random() * charactersLength))
  12.     }
  13.     return result
  14.   },
  15.   // console.log("Random====");
  16.   // console.log(randomId(15));
  17.  
  18.   authHeaderLogin() {
  19.     // const deviceId = this.randomId(15)
  20.     // console.log('AAAAAAAAAAA')
  21.     // console.log(deviceId)
  22.     // util.SaveSession('deviceId', deviceId)
  23.     // const token = util.ReadSession(AUTH_TOKEN_LOCAL)
  24.     // console.log(token)
  25.     const config = {
  26.       headers: {
  27.         'Cache-Control': 'no-cache',
  28.         'Content-Type': 'application/json',
  29.       },
  30.     }
  31.     return config
  32.   },
  33.  
  34.   authHeader() {
  35.     // console.log("BBBBBBBBB")
  36.     // console.log(deviceId)
  37.     const token = util.ReadSession(AUTH_TOKEN_LOCAL)
  38.     const config = {
  39.       headers: {
  40.         // "x-device-id": deviceId,
  41.         Authorization: 'Bearer ' + token,
  42.       },
  43.     }
  44.     return config
  45.   },
  46. }
  47.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement