Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add toAxiosConfig #56

Open
KillWolfVlad opened this issue Nov 15, 2023 · 0 comments
Open

Add toAxiosConfig #56

KillWolfVlad opened this issue Nov 15, 2023 · 0 comments
Labels
enhancement New feature or request js/ts

Comments

@KillWolfVlad
Copy link
Collaborator

KillWolfVlad commented Nov 15, 2023

Also need #42

import { AxiosRequestConfig } from "axios";

import { ClientConfigDto, ClientHeadersConfigDto } from "../config";

export const toAxiosConfig = (config: ClientConfigDto): AxiosRequestConfig => {
  const headers = config.headers
    ? Object.fromEntries(
        Object.entries(config.headers as ClientHeadersConfigDto).filter(
          ([, value]) => value !== undefined,
        ),
      )
    : {};

  return {
    ...config,
    headers,
  };
};
@KillWolfVlad KillWolfVlad added enhancement New feature or request js/ts labels Nov 15, 2023
@KillWolfVlad KillWolfVlad changed the title Add ClientConfigDto & toAxiosConfig Add toAxiosConfig Nov 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request js/ts
Projects
None yet
Development

No branches or pull requests

1 participant