text: import React from 'react';
  import Home from './Home';
  import fetch from '../../core/fetch';
  import needFetch from '../../core/needFetch';
  import Layout from '../../components/Layout';
  import { setData } from '../../actions/data';
  import { showLoading, hideLoading } from 'react-redux-loading-bar'
  
  export default {
    path: '/he-thong-phan-phoi',
    async action({ store, path }) {
      // process.env.BROWSER
      let seo = {}
  
      // if(!process.env.BROWSER || !store.getState().setting.ssr || (process.env.BROWSER && needFetch())) {
      //   store.dispatch(showLoading())
      //   let info = 'info{ menu, menuBottom, phone, fanpage, diachi, thanhtoan, email}'
      //   let noibat = 'getNoiBat{name, slug, price, coverUrl, description, saleOff, body, created_at}'
      //   let khuyenmai = 'getKhuyenMai{name, slug, price, coverUrl, description, saleOff, body, created_at}'
      //   let banchay = 'getBanChay{name, slug, price, coverUrl, description, saleOff, body, created_at}'
      //   const resp = await fetch('/graphql', {
      //     method: 'post',
      //     headers: {
      //       Accept: 'application/json',
      //       'Content-Type': 'application/json',
      //     },
      //     body: JSON.stringify({
      //       query: '{' + noibat + khuyenmai + banchay + info  + 'seo(url: "'+ path +'"){url,title,description,og_title,og_image,og_description},getProducts{name, slug, price, coverUrl, description, saleOff, body, created_at}, getNews(page: 1 ){page,totalPage,data{title, slug, coverUrl, description}}, getFoodNews(page: 1 ){page,totalPage,data{title, slug, coverUrl, description}} }',
      //     }),
      //     credentials: 'include',
      //   });
  
      //   const {data} = await resp.json();
      //   seo = data.seo || {}
      //   if (!data) throw new Error('Failed to load the news feed.');
      //   store.dispatch(setData(data))
      //   store.dispatch(hideLoading())
      // }
  
      return {
        title: seo.title || 'Trang chủ',
        description: seo.description || '',
        seo: seo,
        component: <Layout data={store.getState().data} ><Home data={store.getState().data} /></Layout>,
      };
    },
  
  };
  