Files
gymflow/src/services/plans.ts
2025-12-06 11:32:40 +02:00

19 lines
502 B
TypeScript

import { WorkoutPlan } from '../types';
import { api } from './api';
export const getPlans = async (userId: string): Promise<WorkoutPlan[]> => {
try {
return await api.get<WorkoutPlan[]>('/plans');
} catch {
return [];
}
};
export const savePlan = async (userId: string, plan: WorkoutPlan): Promise<void> => {
await api.post('/plans', plan);
};
export const deletePlan = async (userId: string, id: string): Promise<void> => {
await api.delete(`/plans/${id}`);
};