managarten/apps-archived/clock/apps/web/src/lib/api/alarms.ts
Till JS df7395e57a chore: add archived clock app to apps-archived/
The Clock app source is preserved in apps-archived/ for reference.
This directory is excluded from the pnpm workspace.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-02 13:07:38 +02:00

15 lines
584 B
TypeScript

/**
* Alarms API - Direct API calls for alarms
*/
import { api } from './client';
import type { Alarm, CreateAlarmInput, UpdateAlarmInput } from '@clock/shared';
export const alarmsApi = {
getAll: () => api.get<Alarm[]>('/alarms'),
getById: (id: string) => api.get<Alarm>(`/alarms/${id}`),
create: (input: CreateAlarmInput) => api.post<Alarm>('/alarms', input),
update: (id: string, input: UpdateAlarmInput) => api.patch<Alarm>(`/alarms/${id}`, input),
delete: (id: string) => api.delete(`/alarms/${id}`),
toggle: (id: string) => api.post<Alarm>(`/alarms/${id}/toggle`),
};