import { apiRequest } from "@/shared/api/request"; import { API_ENDPOINTS, API_OPERATIONS, apiEndpointPath } from "@/shared/api/generated/endpoints"; import type { ChangePasswordPayload, LoginPayload, SessionDto } from "@/shared/api/types"; export function login(payload: LoginPayload): Promise { const endpoint = API_ENDPOINTS.login; return apiRequest(apiEndpointPath(API_OPERATIONS.login), { body: payload, method: endpoint.method, skipAuth: true }); } export function logout(): Promise { const endpoint = API_ENDPOINTS.logout; return apiRequest(apiEndpointPath(API_OPERATIONS.logout), { method: endpoint.method, skipAuth: true }); } export function refreshSession(): Promise { const endpoint = API_ENDPOINTS.refresh; return apiRequest(apiEndpointPath(API_OPERATIONS.refresh), { method: endpoint.method, skipAuth: true }); } export function getMe(): Promise { return apiRequest(apiEndpointPath(API_OPERATIONS.me)); } export function changePassword(payload: ChangePasswordPayload): Promise { const endpoint = API_ENDPOINTS.changePassword; return apiRequest(apiEndpointPath(API_OPERATIONS.changePassword), { body: payload, method: endpoint.method }); }