import { AxiosResponse } from 'axios';
import { apiClient } from '../lib/apiClient';
import { Profile } from '../types/profile';

export const setPersonData = (person: { login: string, password: string, role: string, languagesLinks: any[] }, locale: string, jwt: string): Promise<AxiosResponse<{ userData: Profile }>> => (
    apiClient.post(
        '/home/applyperson1',
        { ...person },
        {
            headers: {
                'X-User-Language': locale,
                Authorization: `Bearer ${jwt}`
            }
        }
    )
);

export const getPersonalData = (locale: string, jwt: string): Promise<AxiosResponse<Profile>> => (
    apiClient.post(
        '/home/userdata',
        {},
        {
            headers: {
                'X-User-Language': locale,
                Authorization: `Bearer ${jwt}`
            }
        }
    )
);
