forked from openedx/frontend-app-admin-console
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAddRoleButton.tsx
More file actions
32 lines (26 loc) · 849 Bytes
/
AddRoleButton.tsx
File metadata and controls
32 lines (26 loc) · 849 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import React from 'react';
import { useIntl } from '@edx/frontend-platform/i18n';
import { Button } from '@openedx/paragon';
import { Plus } from '@openedx/paragon/icons';
import baseMessages from '@src/authz-module/messages';
import { useNavigate } from 'react-router-dom';
interface AddRoleButtonProps {
presetUsername?: string;
}
const AddRoleButton = ({ presetUsername }: AddRoleButtonProps) => {
const intl = useIntl();
const navigate = useNavigate();
const handleClick = () => {
const assignRolePath = `/authz/assign-role${presetUsername ? `?username=${presetUsername}` : ''}`;
navigate(assignRolePath);
};
return (
<Button
iconBefore={Plus}
onClick={handleClick}
>
{intl.formatMessage(baseMessages['authz.management.assign.role.title'])}
</Button>
);
};
export default AddRoleButton;