function isEquals(arr, arr2){
if(arr.length != arr2.length) return false
var on = 0;
for( var i = 0; i < arr.length; i++ ){
for( var j = 0; j < arr2.length; j++ ){
if(arr[i] === arr2[j]){
on++
break
}
}
}
return on==arr.length ? true : false
}
fightResolve = (a, b) =>{
const arr = [a.toLowerCase(),b.toLowerCase()]
console.log(isEquals(arr, ['a','s']))
}
fightResolve('a','S')
yield put({
type: BEGIN_FETCHING
})
yield put({
type: END_FETCHING
})
const requestInitialState = () => fetch("http://localhost:3000/data/CatalogNav.json")
.then(response => {
return response.json();
})
.then(data => {
return CatalogNav = { ...data };
console.log(CatalogNav); // {0: {…}, 1: {…}, 2: {…}, 3: {…}, 4: {…}} - выводит заполненный объект
});
class ProtectedRoute extends Component {
render() {
const {component, ...rest} = this.props
return <Route {...rest} render = {this.getComponent}/>
}
getComponent = (...args) => {
return this.props.user && this.props.access.indexOf(this.props.user.role) !== -1 ? <Main title={this.props.title} ><this.props.component {...args} /></Main> :
<ErrorPage/>
}
}
export default connect(state => ({
user: userSelector(state)
}), null, null, { pure: false })(ProtectedRoute)