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/apps/meteor/client/views/admin/integrations/IntegrationsRoute.js

44 lines
1.1 KiB

import { useRouteParameter, useAtLeastOnePermission } from '@rocket.chat/ui-contexts';
import React, { useMemo } from 'react';
import NotAuthorizedPage from '../../notAuthorized/NotAuthorizedPage';
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;