Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import util from '../tools/utility'
- import { AUTH_TOKEN_LOCAL } from 'src/constants/auth'
- export default {
- randomId(length: number) {
- let result = ''
- const characters =
- '!?@#$%&*ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!?@#$%&*'
- const charactersLength = characters.length
- for (let i = 0; i < length; i++) {
- result += characters.charAt(Math.floor(Math.random() * charactersLength))
- }
- return result
- },
- // console.log("Random====");
- // console.log(randomId(15));
- authHeaderLogin() {
- // const deviceId = this.randomId(15)
- // console.log('AAAAAAAAAAA')
- // console.log(deviceId)
- // util.SaveSession('deviceId', deviceId)
- // const token = util.ReadSession(AUTH_TOKEN_LOCAL)
- // console.log(token)
- const config = {
- headers: {
- 'Cache-Control': 'no-cache',
- 'Content-Type': 'application/json',
- },
- }
- return config
- },
- authHeader() {
- // console.log("BBBBBBBBB")
- // console.log(deviceId)
- const token = util.ReadSession(AUTH_TOKEN_LOCAL)
- const config = {
- headers: {
- // "x-device-id": deviceId,
- Authorization: 'Bearer ' + token,
- },
- }
- return config
- },
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement