export const basePath = (servers, serverId) => {
  if (!serverId) return '';
  return servers.find(server => server.id == serverId)?.basePath || '';
};

export const getServer = (servers, serverId) => {
  return servers.find(server => server.id == serverId);
};

export const getHeader = (headers = [], key) => {
  const header = headers.find(header => header.key === key);
  if (!header) {
    const newHeader = { key, value: '', enabled: true };
    headers.push(newHeader);
    return newHeader;
  }
  return header;
};
