22 lines
626 B
TypeScript
22 lines
626 B
TypeScript
import apiClient from './client'
|
|
import type { LoginRequest, LoginResponse, Admin } from '@/types/api'
|
|
|
|
export interface UpdateProfileRequest {
|
|
password?: string
|
|
login?: string
|
|
}
|
|
|
|
export const authApi = {
|
|
login: (data: LoginRequest) =>
|
|
apiClient.post<LoginResponse>('/auth/login', data),
|
|
|
|
getProfile: () =>
|
|
apiClient.get<Admin>('/admin/profile'),
|
|
|
|
logout: () =>
|
|
apiClient.post('/auth/logout'),
|
|
|
|
// 🆕 Смена пароля через существующий endpoint
|
|
updateProfile: (data: UpdateProfileRequest) =>
|
|
apiClient.put<Admin>('/admin/profile', data),
|
|
} |