19 lines
589 B
TypeScript
19 lines
589 B
TypeScript
/**
|
|
* Presence API Service (v0.301 Lot P1)
|
|
* Fetches user presence (online/away/offline, last_seen_at)
|
|
*/
|
|
|
|
import { apiClient } from '@/services/api/client';
|
|
|
|
export interface UserPresence {
|
|
user_id: string;
|
|
status: 'online' | 'away' | 'busy' | 'offline';
|
|
last_seen_at: string | null;
|
|
status_message: string | null;
|
|
}
|
|
|
|
export async function getPresence(userId: string): Promise<UserPresence> {
|
|
const response = await apiClient.get(`/users/${userId}/presence`);
|
|
const data = (response.data as { data?: UserPresence })?.data ?? response.data;
|
|
return data as UserPresence;
|
|
}
|