2022-10-21 17:44:22 +03:00
|
|
|
|
import type { NextPage } from 'next'
|
|
|
|
|
import Head from 'next/head'
|
|
|
|
|
import Image from 'next/image'
|
|
|
|
|
import styles from '../styles/Home.module.css'
|
2022-10-22 00:34:07 +03:00
|
|
|
|
import { Search } from '../сomponents/search'
|
|
|
|
|
import 'antd/dist/antd.css';
|
|
|
|
|
import { useState } from 'react'
|
|
|
|
|
import { TagSearch } from '../сomponents/tagSearch'
|
2022-10-22 10:37:05 +03:00
|
|
|
|
import {useAppDispatch, useAppSelector} from '../hooks';
|
|
|
|
|
import {search, createHints} from '../store/reducers/asyncActions';
|
2022-10-22 19:11:56 +03:00
|
|
|
|
import {products, hints, INode} from '../store/reducers/nodesInputReducer'
|
|
|
|
|
import { ProductsView } from '../сomponents/ProductsView'
|
2022-10-21 17:44:22 +03:00
|
|
|
|
|
|
|
|
|
const Home: NextPage = () => {
|
2022-10-22 10:37:05 +03:00
|
|
|
|
const [goods, setGoods] = useState([]);
|
|
|
|
|
const dispatch = useAppDispatch();
|
|
|
|
|
const getProducts = useAppSelector(products);
|
|
|
|
|
const getHints = useAppSelector(hints);
|
|
|
|
|
|
|
|
|
|
|
2022-10-22 19:11:56 +03:00
|
|
|
|
// if (getProducts.length == 0) {
|
|
|
|
|
// dispatch(
|
|
|
|
|
// search([
|
|
|
|
|
// {
|
|
|
|
|
// 'type': 'Name',
|
|
|
|
|
// 'value': 'Сапоги'
|
|
|
|
|
// }
|
|
|
|
|
// ])
|
|
|
|
|
// )
|
|
|
|
|
// }
|
|
|
|
|
// console.log(getProducts)
|
2022-10-22 10:37:05 +03:00
|
|
|
|
// - вызов поиска
|
|
|
|
|
//
|
|
|
|
|
|
2022-10-21 17:44:22 +03:00
|
|
|
|
return (
|
|
|
|
|
<div className={styles.container}>
|
2022-10-22 00:34:07 +03:00
|
|
|
|
<Search onData={(data)=>setGoods(data)}></Search>
|
2022-10-22 22:40:21 +03:00
|
|
|
|
{
|
|
|
|
|
getProducts.length == 0? null:<ProductsView></ProductsView>
|
|
|
|
|
}
|
|
|
|
|
|
2022-10-21 17:44:22 +03:00
|
|
|
|
</div>
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export default Home
|