import axios, { AxiosResponse } from 'axios';
import { AuthResponse } from '../models/AuthResponse';
import { API_URL } from './index';
import { IRegistration } from '../models/Registr';
export default class AuhtService {
  static async login(email: string, password: string): Promise<AxiosResponse<AuthResponse>> {
    return axios.post<AuthResponse>(`${API_URL}/user/login`, {
      email,
      password,
    });
  }
  static async registration(
    name: string,
    email: string,
    password: string,
    role: string,
  ): Promise<AxiosResponse<AuthResponse>> {
    return axios.post(`${API_URL}/user/registration`, {
      name,
      email,
      password,
      role,
    });
  }
}