Guest User

Untitled

a guest
Feb 3rd, 2021
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2. export class Client {
  3.     private static instance: Client;
  4.     public axios: AxiosInstance;
  5.  
  6.     public static getInstance(): Client {
  7.         if (!Client.instance) {
  8.             Client.instance = new Client();
  9.         }
  10.  
  11.         return Client.instance;
  12.     }
  13.  
  14.     private constructor() {
  15.         this.axios = axios.create({
  16.             proxy: proxyConfig,
  17.         });
  18.  
  19.         this.axios.interceptors.request.use(({ headers, ...param }: AxiosRequestConfig) => ({
  20.             ...param,
  21.             baseURL: '/api',
  22.             headers: {
  23.                 ...headers,
  24.                 'x-channel': 'WEB',
  25.             },
  26.         }));
  27.  
  28.         this.init();
  29.     }
  30.  
  31.     init = async () => {
  32.         if (!getValue(BANK_DEVICE_TOKEN_KEY)) {
  33.             const token = getBankDeviceTokenHeaders();
  34.             console.log(token);
  35.             debugger;
  36.             return token;
  37.         }
  38.     };
  39. }
Advertisement
Add Comment
Please, Sign In to add comment