import './App.css'; import { BrowserRouter as Router, Route, Link, Switch, Redirect } from 'react-router-dom'; import createHistory from "history/createBrowserHistory"; import React, { useState } from 'react'; import { Provider, connect } from 'react-redux'; import store from './reducers'; import { actionFullLogin, actionFullRegister, actionUploadFile, actionGetFile, actionFullAddChat, actionFullEditMSG, actionFullGetChats, actionAddMSG } from './actions'; import { MyDropzone } from './components/dropzone'; import { LoginForm } from './components/loginForm'; import { RegistrationForm } from './components/registrationForm'; import { ConnectChatOnline, ConnectMain } from './pages/main'; //for tests // let msgARR = [{ "_id": "615e0b5fdd6e923e41f3348e", "text": "hi111", "createdAt": "1633553247000", "owner": { "login": "test1111", "_id": "61460c90ae7d905e54d32d11", "nick": null } }, // { "_id": "615e0c88dd6e923e41f3348f", "text": "hi111", "createdAt": "1633553544000", "owner": { "login": "test1111", "_id": "61460c90ae7d905e54d32d11", "nick": null } }, // { "_id": "615e0e02dd6e923e41f33490", "text": "hi111", "createdAt": "1633553922000", "owner": { "login": "test1111", "_id": "61460c90ae7d905e54d32d11", "nick": null } }, // { "_id": "615e102cdd6e923e41f33492", "text": "hi", "createdAt": "1633554476000", "owner": { "login": "test1111", "_id": "61460c90ae7d905e54d32d11", "nick": null } }, // { "_id": "615e113bdd6e923e41f33493", "text": "hi111", "createdAt": "1633554747000", "owner": { "login": "test1111", "_id": "61460c90ae7d905e54d32d11", "nick": null } }, // { "_id": "615e12cddd6e923e41f33495", "text": "hi111", "createdAt": "1633555149000", "owner": { "login": "test1111", "_id": "61460c90ae7d905e54d32d11", "nick": null } }, // { "_id": "615e146bdd6e923e41f33497", "text": "hi111", "createdAt": "1633555563000", "owner": { "login": "test1111", "_id": "61460c90ae7d905e54d32d11", "nick": null } }] // let chatsASS = { // 1: { // title: "первый", // lastModified: "токошо", // avatar: { // url: "/опа" // }, // messages: [{}, {}, { text: "привет" }] // }, // 2: { // title: "второй" // }, // 3: { // title: "третий" // } // } const Preloading = ({ promiseName, promiseState, children }) => { return ( <> {(promiseState[promiseName] && promiseState[promiseName].status === "RESOLVED") ? children : null} ) } const CPreloading = connect(state => ({ promiseState: state.promise })) // const PrivateRoute = ({ component, roles, auth, fallback = "/login", ...originalProps }) => { // const PageWrapper = (pageProps) => { // const OriginalPage = component // //сопоставить роли с аус // if (пересечение роли с аус(ацл из него) в наличии) { // return // } else { // return // } // } // return ( // // ) // } // const MyUltraRoute = connect(сделать аус)(PrivateRoute) const ConnectLoginForm = connect(null, { onLogin: actionFullLogin })(LoginForm) const ConnectRegistrationForm = connect(null, { onRegistration: actionFullRegister })(RegistrationForm) const ConnectDropZone = connect(null, { onUpload: actionUploadFile })(MyDropzone) store.subscribe(() => console.log(store.getState())) // console.log(store.dispatch(actionGetFile("61534453dd6e923e41f3344c"))) // store.dispatch(actionFullGetChats("61460c90ae7d905e54d32d11")) function App() { return (
); } export default App;