JavaScript
4
Вклад в тег
<td data-date='' data-age=''></td>
$project_id = empty($_SESSION['selected_menu_item_id']) ? '' :
"tasks.project_id = ".$_SESSION['selected_menu_item_id']." AND";
$current_tasks_list_query = "SELECT
tasks.id AS ID,
tasks.name AS TASK_NAME,
tasks.deadline_datetime AS TASK_DEADLINE,
tasks.status AS TASK_STATUS,
projects.name AS PROJECT_NAME
FROM tasks
JOIN projects
ON tasks.project_id = projects.id
WHERE
$project_id
tasks.author_id = '".$USER['id']."'";
const NotAccess = (props) => {
return (
<div>
Доступ закрыт
</div>
)
}
export default class RouteAdmin extends React.Component {
constructor (props) {
super(props)
this.state = {
component: null
}
}
componentDidMount () {
axios.post('/admin').then(data => data.data).then(data => {
if (data.auth === true) {
const Admin = React.lazy(() => import('./moduleAdmin/Index'))
this.setState({component: Admin})
} else {
this.setState({component: NotAccess})
}
})
}
render () {
const Component = this.state.component
return (
<Route path="/admin" {...this.props} render={this.state.component}/>
)
}
}
<Route path='/admin' render={props => <RouteAdmin {...path} />} />