|
@@ -5,42 +5,18 @@ import {Provider, connect} from 'react-redux';
|
|
|
import {Header, Footer, actionCatalogCard, Main, SearchInput} from "./components/index"
|
|
|
import {BrowserRouter as Router, Route, Link, Switch, Redirect} from 'react-router-dom';
|
|
|
import createHistory from "history/createBrowserHistory";
|
|
|
-import Catalog from "./components/catalog"
|
|
|
+import {Catalog, UpdateForm} from "./components/"
|
|
|
import {createStore, combineReducers, applyMiddleware, compose} from 'redux';
|
|
|
import thunk from 'redux-thunk';
|
|
|
-import {gql, actionPromise, store, promiseReducer, actionSearch, urlUpload} from "./reducers";
|
|
|
+import {gql, actionPromise, store, promiseReducer, actionSearch, urlUpload, updateAction} from "./reducers";
|
|
|
import { useState, useRef } from 'react';
|
|
|
|
|
|
|
|
|
-
|
|
|
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-const UpdateForm = ({}) => {
|
|
|
- const formRef = useRef(null);
|
|
|
- const [isUpdate, changeIt] = useState(false)
|
|
|
- const updateAction = async () => {
|
|
|
- fetch(`${urlUpload}/upload`, {
|
|
|
- method: "POST",
|
|
|
- headers: localStorage.authToken ? {Authorization: 'Bearer ' + localStorage.authToken} : {},
|
|
|
- body: new FormData(formRef.current)
|
|
|
- })
|
|
|
- .then((res) => res.json()).then(res => console.log(res))
|
|
|
-
|
|
|
- changeIt(true)
|
|
|
- }
|
|
|
-
|
|
|
- return(
|
|
|
- <>
|
|
|
- <form action="/upload" method="post" enctype="multipart/form-data" id='form' ref={formRef} onChange = {updateAction}>
|
|
|
- <input type="file" name="photo" id='photo'/>
|
|
|
- </form>
|
|
|
-
|
|
|
- <img src = {`${urlUpload}/images/cbd7145dbc78ced471951c70f571f871`}/>
|
|
|
- </>
|
|
|
- )
|
|
|
-}
|
|
|
|
|
|
|
|
|
function App() {
|
|
@@ -48,7 +24,7 @@ function App() {
|
|
|
<>
|
|
|
<Provider store={store}>
|
|
|
<Router history = {createHistory}>
|
|
|
- {/* <UpdateForm/> */}
|
|
|
+
|
|
|
<Header/>
|
|
|
|
|
|
<Main/>
|