Minor History fix

This commit is contained in:
AG
2025-11-20 23:57:00 +02:00
parent e6a3a5b0ff
commit ada10d52e8
3 changed files with 312 additions and 305 deletions

10
App.tsx
View File

@@ -94,13 +94,19 @@ function App() {
setCurrentTab('TRACK');
};
const handleEndSession = () => {
const handleEndSession = async () => {
if (activeSession && currentUser) {
const finishedSession = { ...activeSession, endTime: Date.now() };
saveSession(currentUser.id, finishedSession);
await saveSession(currentUser.id, finishedSession);
setSessions(prev => [finishedSession, ...prev]);
setActiveSession(null);
setActivePlan(null);
// Refetch user to get updated weight
const res = await getMe();
if (res.success && res.user) {
setCurrentUser(res.user);
}
}
};