import React from 'react'; import { Alert, Button, Modal, Typography } from 'antd'; import styled from 'styled-components'; import { InfoCircleOutlined } from '@ant-design/icons'; const ModalSection = styled.div` display: flex; flex-direction: column; padding-bottom: 12px; `; const ModalSectionHeader = styled(Typography.Text)` &&&& { padding: 0px; margin: 0px; margin-bottom: 4px; } `; const ModalSectionParagraph = styled(Typography.Paragraph)` &&&& { padding: 0px; margin: 0px; } `; const StyledAlert = styled(Alert)` padding-top: 12px; padding-bottom: 12px; margin-bottom: 20px; `; const StyledInfoCircleOutlined = styled(InfoCircleOutlined)` margin-right: 8px; `; type Props = { visible: boolean; onClose: () => void; accessToken: string; expiresInText: string; }; export const AccessTokenModal = ({ visible, onClose, accessToken, expiresInText }: Props) => { const baseUrl = window.location.origin; const accessTokenCurl = `curl -X POST '${baseUrl}/api/graphql' \\ --header 'Authorization: Bearer ${accessToken}' \\ --header 'Content-Type: application/json' \\ --data-raw '{"query":"{\\n me {\\n corpUser {\\n username\\n }\\n }\\n}","variables":{}}'`; return ( New Personal Access Token } visible={visible} onCancel={onClose} footer={ <> } > Make sure to copy your personal access token now. You won’t be able to see it again. } /> Token {expiresInText}
{accessToken}
Usage To use the token, provide it as a Bearer token in the{' '} Authorization header when making API requests:
{accessTokenCurl}
Learn More To learn more about the DataHub APIs, check out the DataHub Docs.
); };