import axios from 'axios';

export default function setAuthorisationToken(token) {
  if (token) {
    axios.defaults.headers.common['x-access-token'] = token;
  } else {
    delete axios.defaults.headers.common['x-access-token'];
  }
};

import axios from 'axios';

export default function setAuthorisationToken(token) {
  // if (token) {
  delete axios.defaults.headers.common['x-access-token'];
  axios.defaults.headers.common['x-access-token'] = token;
  console.log('TOKEN SET!!!!!');
  // } else {
  //   delete axios.defaults.headers.common['x-access-token'];
  // }
}

delete token if available before setting new token