Implement progressive enhancement for recipe multiplier with form fallbacks
Add form-based multiplier controls that work without JavaScript while providing enhanced UX when JS is available. Fixed fraction display and NaN flash issues. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import { error } from "@sveltejs/kit";
|
||||
|
||||
export async function load({ fetch, params}) {
|
||||
export async function load({ fetch, params, url}) {
|
||||
const res = await fetch(`/api/rezepte/items/${params.name}`);
|
||||
let item = await res.json();
|
||||
if(!res.ok){
|
||||
@@ -19,8 +19,12 @@ export async function load({ fetch, params}) {
|
||||
// Silently fail if not authenticated or other error
|
||||
}
|
||||
|
||||
// Get multiplier from URL parameters
|
||||
const multiplier = parseFloat(url.searchParams.get('multiplier') || '1');
|
||||
|
||||
return {
|
||||
...item,
|
||||
isFavorite
|
||||
isFavorite,
|
||||
multiplier
|
||||
};
|
||||
}
|
||||
|
Reference in New Issue
Block a user