fixing typescript issue

This commit is contained in:
Kfir Dayan 2023-06-13 16:10:59 +03:00
parent a517def07d
commit 5505f8e2be

View file

@ -12,7 +12,7 @@ export async function addToCart(req: Request, res: Response) {
res.status(400).json({ error: 'Product id is required.' });
return;
}
let cart: ICart = await Cart.findOne({ userId });
let cart: ICart | null = await Cart.findOne({ userId });
if (!cart) {
cart = await Cart.create({
userId,