All files / src/api/connector utility.js

85.71% Statements 6/7
50% Branches 2/4
100% Functions 1/1
85.71% Lines 6/7
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21          4x 4x   4x       4x 4x     4x        
import { isNil } from 'lodash';
import { localStorage } from '../../utility';
 
/* eslint import/prefer-default-export:"off" */
export function getCommonMeta(connector) {
  const token = localStorage.getAuthToken();
  const headers = {};
 
  Iif (!isNil(token)) {
    headers.authorization = `Bearer ${token}`;
  }
 
  Eif (connector) {
    headers['X-NSFT-CONNECTOR-INSTANCE'] = connector.id;
  }
 
  return {
    headers,
  };
}