Exercise archivation fixed
This commit is contained in:
@@ -72,7 +72,9 @@ const Profile: React.FC<ProfileProps> = ({ user, onLogout, lang, onLanguageChang
|
||||
};
|
||||
|
||||
const refreshExercises = async () => {
|
||||
setExercises(await getExercises(user.id));
|
||||
const exercises = await getExercises(user.id);
|
||||
console.log('Refreshed exercises:', exercises);
|
||||
setExercises(exercises);
|
||||
};
|
||||
|
||||
// Snackbar State
|
||||
@@ -160,10 +162,12 @@ const Profile: React.FC<ProfileProps> = ({ user, onLogout, lang, onLanguageChang
|
||||
};
|
||||
|
||||
// Exercise Management Handlers
|
||||
const handleArchiveExercise = (ex: ExerciseDef, archive: boolean) => {
|
||||
const handleArchiveExercise = async (ex: ExerciseDef, archive: boolean) => {
|
||||
const updated = { ...ex, isArchived: archive };
|
||||
saveExercise(user.id, updated);
|
||||
refreshExercises();
|
||||
console.log('Archiving exercise:', updated);
|
||||
await saveExercise(user.id, updated);
|
||||
console.log('Archive complete, refreshing...');
|
||||
await refreshExercises();
|
||||
};
|
||||
|
||||
const handleSaveExerciseEdit = () => {
|
||||
|
||||
Reference in New Issue
Block a user