import { NextPage } from 'next'; import { SearchResponse } from '../../prismic/api'; import { ProductPageData } from '../../typings/entities'; import { Link } from '../../i18n'; interface PageProps { products?: SearchResponse; namespacesRequired?: string[]; error?: boolean; } const ProductsHome: NextPage = ({ products, error }) => { if (error) { return (

Page not found !

); } const links = products.results.map((product) => (
  • {(product.data.product_name)}
  • )); return ( <>

    TODO: Hub produits

    ); }; ProductsHome.getInitialProps = async ({ res }): Promise => { res.writeHead(302, { Location: '/' }); res.end(); return { namespacesRequired: ['common'] }; // Disabled for now // try { // const products = await getProducts(req); // return { products, namespacesRequired: ['common', 'product'] }; // } catch (err) { // return { error: true }; // } }; export default ProductsHome;