mirror of
https://github.com/elyby/accounts-frontend.git
synced 2025-05-31 14:11:58 +05:30
Implemented strict mode for the project (broken tests, hundreds of @ts-ignore and new errors are included) [skip ci]
This commit is contained in:
committed by
SleepWalker
parent
10e8b77acf
commit
96049ad4ad
@@ -1,20 +1,22 @@
|
||||
import React, { useContext } from 'react';
|
||||
import React, { ComponentType, useContext } from 'react';
|
||||
import { FormattedMessage as Message, MessageDescriptor } from 'react-intl';
|
||||
|
||||
import Context, { AuthContext } from './Context';
|
||||
|
||||
interface Props {
|
||||
isAvailable?: (context: AuthContext) => boolean;
|
||||
payload?: { [key: string]: any };
|
||||
payload?: Record<string, any>;
|
||||
label: MessageDescriptor;
|
||||
}
|
||||
|
||||
export type RejectionLinkProps = Props;
|
||||
|
||||
function RejectionLink(props: Props) {
|
||||
const RejectionLink: ComponentType<Props> = ({
|
||||
isAvailable,
|
||||
payload,
|
||||
label,
|
||||
}) => {
|
||||
const context = useContext(Context);
|
||||
|
||||
if (props.isAvailable && !props.isAvailable(context)) {
|
||||
if (isAvailable && !isAvailable(context)) {
|
||||
// TODO: if want to properly support multiple links, we should control
|
||||
// the dividers ' | ' rendered from factory too
|
||||
return null;
|
||||
@@ -26,12 +28,12 @@ function RejectionLink(props: Props) {
|
||||
onClick={event => {
|
||||
event.preventDefault();
|
||||
|
||||
context.reject(props.payload);
|
||||
context.reject(payload);
|
||||
}}
|
||||
>
|
||||
<Message {...props.label} />
|
||||
<Message {...label} />
|
||||
</a>
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
export default RejectionLink;
|
||||
|
||||
Reference in New Issue
Block a user