- added new root manage UIs;
This commit is contained in:
35
src/pages/AdminSetNdg/index.js
Normal file
35
src/pages/AdminSetNdg/index.js
Normal file
@@ -0,0 +1,35 @@
|
||||
import React, { useEffect } from 'react';
|
||||
import { __ } from '@wordpress/i18n';
|
||||
import { intersection } from 'ramda';
|
||||
import { useNavigate } from 'react-router-dom';
|
||||
|
||||
// store
|
||||
import { useStoreValue } from '../../store';
|
||||
|
||||
// components
|
||||
import { Button } from 'primereact/button';
|
||||
import ManageNdgSection from '../Admin/components/ManageNdgSection';
|
||||
|
||||
const AdminSetNdg = () => {
|
||||
const permissions = useStoreValue('getPermissions');
|
||||
const navigate = useNavigate();
|
||||
const hasPermission = intersection(permissions, ['ROOT_MANAGE_NDG']).length > 0;
|
||||
|
||||
useEffect(() => {
|
||||
if (!hasPermission) navigate('/admin');
|
||||
}, [hasPermission]);
|
||||
|
||||
return <div className="appPage">
|
||||
<div className="appPage__pageHeader">
|
||||
<h1>{__('Gestione NDG', 'gepafin')}</h1>
|
||||
</div>
|
||||
<div className="appPage__spacer"></div>
|
||||
<div className="appPageSection__actions">
|
||||
<Button type="button" outlined label={__('Indietro', 'gepafin')} icon="pi pi-arrow-left" onClick={() => navigate('/admin')}/>
|
||||
</div>
|
||||
<div className="appPage__spacer"></div>
|
||||
{hasPermission && <ManageNdgSection/>}
|
||||
</div>
|
||||
}
|
||||
|
||||
export default AdminSetNdg;
|
||||
Reference in New Issue
Block a user