feat: Implement active workout flow with status management
- Added `status`, `total_sets`, and `total_volume` fields to the Workout model. - Introduced `source_kind`, `title_snapshot`, and `image_s3_url_snapshot` fields to the WorkoutItem model. - Created endpoints for managing active workouts, including finishing and discarding workouts. - Updated workout creation to ensure only one active workout exists per user. - Implemented batch addition of workout sets and updates to workout set details. - Enhanced database schema with Alembic migrations to support new fields and constraints. - Added validation to ensure at least one field is provided for workout set updates. - Updated calorie estimation logic to reflect new workout set structure.
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
import type { AuthState } from "../../api";
|
||||
|
||||
const authStorageKey = "train-watcher-auth";
|
||||
|
||||
export function loadAuth(): AuthState | null {
|
||||
const raw = localStorage.getItem(authStorageKey);
|
||||
if (!raw) return null;
|
||||
try {
|
||||
return JSON.parse(raw) as AuthState;
|
||||
} catch {
|
||||
localStorage.removeItem(authStorageKey);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
export function saveAuth(auth: AuthState) {
|
||||
localStorage.setItem(authStorageKey, JSON.stringify(auth));
|
||||
}
|
||||
|
||||
export function clearAuth() {
|
||||
localStorage.removeItem(authStorageKey);
|
||||
}
|
||||
Reference in New Issue
Block a user