import { apiClient } from '../lib/apiClient'; import {GeneralFilter, ExpertsData, ExpertDetails, ExpertScheduler, ExpertSchedulerSession} from '../types/experts'; import {useLocalStorage} from "../hooks/useLocalStorage"; import {AUTH_TOKEN_KEY} from "../constants/common"; export const getExpertsList = async (locale: string, filter?: GeneralFilter) => { const response = await apiClient.post( '/home/coachsearch1', { ...filter }, { headers: { 'X-User-Language': locale } } ); return response.data as ExpertsData || null; }; export const getExpertById = async (id: string, locale: string) => { const response = await apiClient.post( '/home/coachdetails', { id }, { headers: { 'X-User-Language': locale } } ); return response.data as ExpertDetails || null; }; export const getSchedulerByExpertId = async (expertId: string, locale: string, jwt: string) => { const response = await apiClient.post( '/home/sessionsignupdata', { id: expertId }, { headers: { 'X-User-Language': locale, Authorization: `Bearer ${jwt}` } } ); return response.data as ExpertScheduler || null; }; export const getSchedulerSession = async (data: { coachId: number, tagId: number, startAtUtc: string, clientComment: string }, locale: string, jwt: string) => { const response = await apiClient.post( '/home/sessionsignupsubmit', data, { headers: { 'X-User-Language': locale, Authorization: `Bearer ${jwt}` } } ); return response.data as ExpertSchedulerSession || null; };