import axios from 'axios';
import { environment } from '../enviroments/enviroments';
import Cookies from 'js-cookie';

export const logout = (): any => {
  const csrftokens = Cookies.get('csrftoken');
  return axios({
    method: 'post',
    url: `/${environment.localeRu}${environment.apiPrefix}${environment.endPoints.logout}`,
    headers: {
      'Content-Type': 'application/json',
      'X-CSRFToken': csrftokens || true,
    },
    xsrfHeaderName: 'X-CSRFToken',
    xsrfCookieName: 'csrftoken',
    withCredentials: true,
  });
};
