The communications platform that puts data protection first.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
Rocket.Chat/client/views/admin/integrations/IntegrationsRoute.js

45 lines
1.2 KiB

import React, { useMemo } from 'react';
import NotAuthorizedPage from '../../../components/NotAuthorizedPage';
import { useAtLeastOnePermission } from '../../../contexts/AuthorizationContext';
import { useRouteParameter } from '../../../contexts/RouterContext';
import IntegrationsPage from './IntegrationsPage';
import EditIntegrationsPage from './edit/EditIntegrationsPage';
import OutgoingWebhookHistoryPage from './edit/OutgoingWebhookHistoryPage';
import NewIntegrationsPage from './new/NewIntegrationsPage';
function IntegrationsRoute() {
const canViewIntegrationsPage = useAtLeastOnePermission(
useMemo(
() => [
'manage-incoming-integrations',
'manage-outgoing-integrations',
'manage-own-incoming-integrations',
'manage-own-outgoing-integrations',
],
[],
),
);
const context = useRouteParameter('context');
if (!canViewIntegrationsPage) {
return <NotAuthorizedPage />;
}
if (context === 'new') {
return <NewIntegrationsPage />;
}
if (context === 'edit') {
return <EditIntegrationsPage />;
}
if (context === 'history') {
return <OutgoingWebhookHistoryPage />;
}
return <IntegrationsPage />;
}
export default IntegrationsRoute;