diff --git a/pages/api/consts.ts b/pages/api/consts.ts
index 70bb223..f84d548 100644
--- a/pages/api/consts.ts
+++ b/pages/api/consts.ts
@@ -1 +1 @@
-export const host = "https://0c9e-5-227-22-1.eu.ngrok.io/api/"
\ No newline at end of file
+export const host = "https://7ee1-5-227-22-5.eu.ngrok.io/api/"
\ No newline at end of file
diff --git a/store/reducers/nodesInputReducer.ts b/store/reducers/nodesInputReducer.ts
index aacfc54..096d987 100644
--- a/store/reducers/nodesInputReducer.ts
+++ b/store/reducers/nodesInputReducer.ts
@@ -15,7 +15,9 @@ export interface IHint{
export interface IProduct{
name: string;
category: string;
- characteristics: {
+ id:number,
+ score:number,
+ characteristic: {
name: string;
value: string;
}[];
diff --git a/сomponents/ProductsView/index.tsx b/сomponents/ProductsView/index.tsx
index 0fee8d0..b8998e1 100644
--- a/сomponents/ProductsView/index.tsx
+++ b/сomponents/ProductsView/index.tsx
@@ -1,23 +1,25 @@
import { Card } from "antd";
import React from "react";
import { useAppSelector } from "../../hooks";
+import { fetcher } from "../../pages/api/fetch";
import { products } from "../../store/reducers/nodesInputReducer";
export const ProductsView:React.FC = () =>{
const getProducts = useAppSelector(products)
- console.log(getProducts)
+ console.log("Продукты", getProducts)
return(
{
getProducts.map(el=>
- {el.category}
+ {el.score}
{
- el.characteristics == undefined? "":el.characteristics.toString()
+ el.characteristic == undefined? "":el.characteristic.map(e=>
)
}
+ fetcher.post("/score/"+el.id)}>Посмотреть
)
}
diff --git a/сomponents/search/index.tsx b/сomponents/search/index.tsx
index be14801..46db4f0 100644
--- a/сomponents/search/index.tsx
+++ b/сomponents/search/index.tsx
@@ -4,6 +4,8 @@ import { fetcher } from "../../pages/api/fetch";
import { useAppDispatch, useAppSelector } from "../../hooks";
import { hints, INode, products } from "../../store/reducers/nodesInputReducer";
import { createHints, search } from "../../store/reducers/asyncActions";
+import styles from "./search.module.css"
+
export const Search: React.FC<{onData:(data:any)=>void}> = (props) =>{
const [data, setData] = useState("")
@@ -12,9 +14,9 @@ export const Search: React.FC<{onData:(data:any)=>void}> = (props) =>{
const dispatch = useAppDispatch();
const getHints = useAppSelector(hints);
const [autoCompleteValue, setAutoCompleteValue] = useState("")
+
const onChange = (text:string) =>{
if (text.length >= 3 && text.length%3 == 0){
-
dispatch(
createHints({word:text, hints:getHints.length == 0? []: getHints.map((el)=>el.value)})
)
@@ -61,9 +63,9 @@ export const Search: React.FC<{onData:(data:any)=>void}> = (props) =>{
onSelect={onSelect as any}
value={autoCompleteValue}
onChange={(e)=>setAutoCompleteValue(e)}
- // onSearch={handleSearch}
>
onChange(e.target.value)}
value={data}
onSearch={(e) => onEnter(e)}
diff --git a/сomponents/search/search.module.css b/сomponents/search/search.module.css
index e69de29..0afc672 100644
--- a/сomponents/search/search.module.css
+++ b/сomponents/search/search.module.css
@@ -0,0 +1,3 @@
+.search{
+
+}
\ No newline at end of file