24 lines
No EOL
676 B
TypeScript
24 lines
No EOL
676 B
TypeScript
import { apiClient } from './apiClient'
|
|
import { logger } from '../utils/logger'
|
|
|
|
interface AuthResponse {
|
|
access_token: string
|
|
expires_at: string
|
|
}
|
|
|
|
export interface AuthLoginPayload {
|
|
username: string
|
|
password: string
|
|
}
|
|
|
|
export const authService = {
|
|
login: async (payload: AuthLoginPayload) => {
|
|
logger.info('🔐 [authService] Making request to /v1/auth/login with:', payload)
|
|
const data = await apiClient.post<AuthResponse>('v1/auth/login', payload)
|
|
logger.info('🔐 [authService] Response data:', data)
|
|
return { token: data.access_token, expiresAt: data.expires_at }
|
|
},
|
|
logout: async () => {
|
|
await apiClient.post('v1/auth/logout')
|
|
}
|
|
} |