import { request, type SessionTiming } from '../core/httpClient'; import type { ManagedUser } from '../types'; import type { LoginSession, Portal } from '../session'; export const portalSessionApi = { current: (portal: Portal) => request(`/${portal}/auth/session`, { suppressSessionRedirect: true }), touch: (portal: Portal) => request(`/${portal}/auth/session/touch`, { method: 'POST', body: '{}' }), lock: (portal: Portal) => request<{ locked: boolean }>(`/${portal}/auth/session/lock`, { method: 'POST', body: '{}' }), unlock: (portal: Portal, password: string) => request(`/${portal}/auth/session/unlock`, { method: 'POST', body: JSON.stringify({ password }) }), reauthenticate: (portal: Portal, password: string) => request>(`/${portal}/auth/reauthenticate`, { method: 'POST', body: JSON.stringify({ password }), reauthenticationAttempted: true }), logout: (portal: Portal) => request<{ success: boolean }>(`/${portal}/auth/logout`, { method: 'POST', body: '{}' }), changeOwnPassword: (portal: Portal, body: { currentPassword: string; password: string }) => request(`/${portal}/auth/password`, { method: 'POST', body: JSON.stringify(body) }), };