feat: add success toasts for create operations and login

- Add toast.success when workout is created or updated
- Add toast.success when user logs in successfully
- Show descriptive messages with entity names
- Improves user feedback for successful operations
This commit is contained in:
Millian Lamiaux
2026-03-17 11:47:17 +01:00
parent 3d026b68ee
commit fc43f73b82
2 changed files with 9 additions and 0 deletions

View File

@@ -2,6 +2,7 @@
import { useState } from "react";
import { useRouter } from "next/navigation";
import { toast } from "sonner";
import { supabase } from "@/lib/supabase";
import { Button } from "@/components/ui/button";
import { Input } from "@/components/ui/input";
@@ -43,6 +44,10 @@ export default function LoginPage() {
throw new Error("Not authorized as admin");
}
toast.success("Welcome back!", {
description: "You have successfully signed in."
})
// Force a full page reload to ensure middleware picks up the session
window.location.href = "/";
} catch (err) {

View File

@@ -213,6 +213,10 @@ export default function WorkoutForm({ initialData, mode = "create" }: WorkoutFor
}
}
toast.success(mode === "edit" ? "Workout updated" : "Workout created", {
description: `"${title}" has been ${mode === "edit" ? "updated" : "created"} successfully.`
})
router.push(`/workouts/${result.data.id}`)
} catch (err) {
console.error("Failed to save workout:", err)