Untitled

 avatar
unknown
plain_text
10 months ago
507 B
4
Indexable
useEffect(() => {
    const fetchOrders = async () => {
      try {
        const orders = await OrderController.fetchOrders();
        setOrders(orders);
        setLoading(false);
      } catch (error) {
        if (error.message === 'Unauthorized') {
          navigate('/login'); // Reindirizza alla pagina di login se l'utente non è autorizzato
        } else {
          console.error('Errore nel recupero degli ordini:', error);
        }
      }
    };

    fetchOrders();
  }, []);
Editor is loading...
Leave a Comment