Add type definition for products state in CreateRecipePage component

This commit is contained in:
Nils-Johan Gynther
2026-04-09 23:04:15 +02:00
parent 69393f407c
commit a2f30d6cfb
@@ -3,6 +3,7 @@
import { useState, useEffect } from 'react'; import { useState, useEffect } from 'react';
import { useRouter } from 'next/navigation'; import { useRouter } from 'next/navigation';
import { fetchJson } from '../../../lib/api'; import { fetchJson } from '../../../lib/api';
import type { Product } from '../../../features/inventory/types';
export default function CreateRecipePage() { export default function CreateRecipePage() {
const router = useRouter(); const router = useRouter();
@@ -12,7 +13,7 @@ export default function CreateRecipePage() {
instructions: '', instructions: '',
ingredients: [{ productId: 0, quantity: '', unit: '', note: '' }], ingredients: [{ productId: 0, quantity: '', unit: '', note: '' }],
}); });
const [products, setProducts] = useState([]); const [products, setProducts] = useState<Product[]>([]);
const [isLoading, setIsLoading] = useState(false); const [isLoading, setIsLoading] = useState(false);
const [error, setError] = useState<string | null>(null); const [error, setError] = useState<string | null>(null);