17 lines
589 B
TypeScript
17 lines
589 B
TypeScript
import {deleteJson, postJson, type Endpoint} from '@/shared/services/httpClient';
|
|
import type {DeviceSession} from '@/features/settings/services/mapSession';
|
|
|
|
/** Signed-in devices, and the two ways to end them. */
|
|
export const securityRepository = {
|
|
sessions: (): Endpoint<DeviceSession[]> => ({
|
|
path: '/api/auth/sessions',
|
|
params: {},
|
|
}),
|
|
|
|
revoke: (id: string) =>
|
|
deleteJson<null>(`/api/auth/sessions/${encodeURIComponent(id)}`),
|
|
|
|
/** Keeps this browser signed in — see the route. */
|
|
revokeOthers: () => postJson<null>('/api/auth/sessions/revoke-others', {}),
|
|
};
|