import React from 'react';
import Styles from './styles.module.less';
import { Avatar } from 'antd';
const Authorize = (props) => {
const { oakFullpath, loading, hasError, errorMsg, userInfo, response_type, client_id, redirect_uri, scope, state, clientInfo, name, nickname, mobile, avatarUrl } = props.data;
const { t, handleGrant, handleDeny } = props.methods;
// Loading state
if (loading) {
return (
{t('oauth.authorize.loading')}
);
}
// Error state
if (hasError) {
return (
{t('oauth.authorize.error.title')}
{t(errorMsg)}
);
}
// Logged in - show authorization confirmation
return (
{t('oauth.authorize.title')}
{t('oauth.authorize.description')}
{t('oauth.authorize.clientName')}:
{clientInfo?.name || client_id}
{clientInfo?.description && (<>
{t('oauth.authorize.clientDescription')}:
{clientInfo.description}
>)}
{t('oauth.authorize.scope')}
✓
{t('oauth.authorize.allPermissions')}
{avatarUrl ? (
) : (
{nickname?.[0]}
)}
{name || nickname}
{mobile &&
{mobile}
}
);
};
export default Authorize;