|
@@ -1,4 +1,4 @@
|
|
|
-import React, {useState, useEffect, useRef} from 'react';
|
|
|
+import React, {useState, useEffect, useRef, Component} from 'react';
|
|
|
import logo from './logo.svg'
|
|
|
import './App.scss'
|
|
|
import {Provider, connect} from 'react-redux'
|
|
@@ -28,6 +28,27 @@ const Page404 = () => (
|
|
|
<h1>Тут ведутся работы</h1>
|
|
|
)
|
|
|
|
|
|
+
|
|
|
+
|
|
|
+const RRoute = ({ action, component:Component, ...routeProps}) => {
|
|
|
+ const WrapperComponent = (componentProps) => {
|
|
|
+ action(componentProps.match)
|
|
|
+ return <Component {...componentProps} />
|
|
|
+ }
|
|
|
+ return <Route {...routeProps} component={WrapperComponent} />
|
|
|
+}
|
|
|
+const CRRoute = connect(null, {action: match => ({type: 'ROUTE', match})})(RRoute)
|
|
|
+
|
|
|
+// const ProtectedRoute = ({ fallback='/',
|
|
|
+// roles=["admin"],
|
|
|
+// auth,
|
|
|
+
|
|
|
+// })
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
const AuthSwitch = ({token}) => {
|
|
|
return (
|
|
|
<>
|