Code maintainability fixes

This commit is contained in:
AG
2025-12-06 11:32:40 +02:00
parent a13ef9f479
commit 4106f3b783
23 changed files with 1775 additions and 796 deletions

18
src/services/plans.ts Normal file
View File

@@ -0,0 +1,18 @@
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}`);
};