|
@@ -1,7 +1,8 @@
|
|
|
import { connect } from "react-redux";
|
|
|
import {gql, urlUpload, actionPromise} from "../reducers";
|
|
|
import {createStore, combineReducers, applyMiddleware, bindActionCreators} from 'redux';
|
|
|
-import { useEffect } from 'react';
|
|
|
+import { useEffect, useState } from 'react';
|
|
|
+import {BrowserRouter as Router, Route, Link, Switch, Redirect, useHistory} from 'react-router-dom';
|
|
|
|
|
|
|
|
|
|
|
@@ -50,8 +51,32 @@ const actionGoodCard = (_id) => {
|
|
|
|
|
|
|
|
|
const GoodCard = ({id, goodCard = null, getData, className = "goodCard"}) => {
|
|
|
- useEffect(() => getData(id), [id])
|
|
|
- console.log(goodCard)
|
|
|
+ const history = useHistory();
|
|
|
+ useEffect(() => getData(id), [id]);
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ const [width, setWidth] = useState(window.innerWidth);
|
|
|
+ const [startWidth, setStartwidth] = useState(true);
|
|
|
+ const [finallyWidth, setFinallyWidth] = useState(true);
|
|
|
+
|
|
|
+ useEffect(() => startWidth !== finallyWidth && window.location.reload(), [startWidth, finallyWidth])
|
|
|
+
|
|
|
+
|
|
|
+ window.onresize = () => {
|
|
|
+
|
|
|
+ width > 900 ? setStartwidth(true) : setStartwidth(false);
|
|
|
+
|
|
|
+ setWidth(window.innerWidth);
|
|
|
+
|
|
|
+ width > 900 ? setFinallyWidth(true) : setFinallyWidth(false);
|
|
|
+
|
|
|
+ // startWidth !== finallyWidth && history.push("./catalog")
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
return(
|
|
|
<>
|
|
|
{ goodCard &&
|