mirror of
https://github.com/elyby/accounts-frontend.git
synced 2025-05-31 14:11:58 +05:30
Fix type and lint errors after upgrading corresponding dependencies
This commit is contained in:
@@ -41,11 +41,11 @@ export function authenticate(
|
||||
}
|
||||
|
||||
try {
|
||||
const { token: newToken, refreshToken: newRefreshToken, user } = await validateToken(
|
||||
accountId,
|
||||
token,
|
||||
refreshToken,
|
||||
);
|
||||
const {
|
||||
token: newToken,
|
||||
refreshToken: newRefreshToken,
|
||||
user,
|
||||
} = await validateToken(accountId, token, refreshToken);
|
||||
const newAccount: Account = {
|
||||
id: user.id,
|
||||
username: user.username,
|
||||
|
||||
@@ -405,7 +405,7 @@ class PanelTransition extends React.PureComponent<Props, State> {
|
||||
|
||||
getHeader({ key, style, data }: TransitionPlainStyle): ReactElement {
|
||||
const { Title } = data as AnimationData;
|
||||
const { transformSpring } = (style as unknown) as AnimationStyle;
|
||||
const { transformSpring } = style as unknown as AnimationStyle;
|
||||
|
||||
let { hasBackButton } = data;
|
||||
|
||||
@@ -414,7 +414,7 @@ class PanelTransition extends React.PureComponent<Props, State> {
|
||||
}
|
||||
|
||||
const transitionStyle = {
|
||||
...this.getDefaultTransitionStyles(key, (style as unknown) as AnimationStyle),
|
||||
...this.getDefaultTransitionStyles(key, style as unknown as AnimationStyle),
|
||||
opacity: 1, // reset default
|
||||
};
|
||||
|
||||
@@ -448,7 +448,7 @@ class PanelTransition extends React.PureComponent<Props, State> {
|
||||
|
||||
getBody({ key, style, data }: TransitionPlainStyle): ReactElement {
|
||||
const { Body } = data as AnimationData;
|
||||
const { transformSpring } = (style as unknown) as AnimationStyle;
|
||||
const { transformSpring } = style as unknown as AnimationStyle;
|
||||
const { direction } = this.state;
|
||||
|
||||
let transform = this.translate(transformSpring, direction);
|
||||
@@ -460,7 +460,7 @@ class PanelTransition extends React.PureComponent<Props, State> {
|
||||
}
|
||||
|
||||
const transitionStyle: CSSProperties = {
|
||||
...this.getDefaultTransitionStyles(key, (style as unknown) as AnimationStyle),
|
||||
...this.getDefaultTransitionStyles(key, style as unknown as AnimationStyle),
|
||||
top: 'auto', // reset default
|
||||
[verticalOrigin]: 0,
|
||||
...transform,
|
||||
@@ -486,7 +486,7 @@ class PanelTransition extends React.PureComponent<Props, State> {
|
||||
getFooter({ key, style, data }: TransitionPlainStyle): ReactElement {
|
||||
const { Footer } = data as AnimationData;
|
||||
|
||||
const transitionStyle = this.getDefaultTransitionStyles(key, (style as unknown) as AnimationStyle);
|
||||
const transitionStyle = this.getDefaultTransitionStyles(key, style as unknown as AnimationStyle);
|
||||
|
||||
return (
|
||||
<div key={`footer/${key}`} style={transitionStyle}>
|
||||
@@ -498,7 +498,7 @@ class PanelTransition extends React.PureComponent<Props, State> {
|
||||
getLinks({ key, style, data }: TransitionPlainStyle): ReactElement {
|
||||
const { Links } = data as AnimationData;
|
||||
|
||||
const transitionStyle = this.getDefaultTransitionStyles(key, (style as unknown) as AnimationStyle);
|
||||
const transitionStyle = this.getDefaultTransitionStyles(key, style as unknown as AnimationStyle);
|
||||
|
||||
return (
|
||||
<div key={`links/${key}`} style={transitionStyle}>
|
||||
|
||||
@@ -15,18 +15,19 @@ interface Props {
|
||||
const AccountSwitcher: ComponentType<Props> = ({ accounts, onAccountClick }) => {
|
||||
const [selectedAccount, setSelectedAccount] = useState<number>();
|
||||
const onAccountClickCallback = useCallback(
|
||||
(account: Account): MouseEventHandler => async (event) => {
|
||||
event.stopPropagation();
|
||||
(account: Account): MouseEventHandler =>
|
||||
async (event) => {
|
||||
event.stopPropagation();
|
||||
|
||||
setSelectedAccount(account.id);
|
||||
try {
|
||||
if (onAccountClick) {
|
||||
await onAccountClick(account);
|
||||
setSelectedAccount(account.id);
|
||||
try {
|
||||
if (onAccountClick) {
|
||||
await onAccountClick(account);
|
||||
}
|
||||
} finally {
|
||||
setSelectedAccount(undefined);
|
||||
}
|
||||
} finally {
|
||||
setSelectedAccount(undefined);
|
||||
}
|
||||
},
|
||||
},
|
||||
[onAccountClick],
|
||||
);
|
||||
|
||||
|
||||
@@ -44,7 +44,7 @@ const typeToForm: TypeToForm = {
|
||||
|
||||
type TypeToLabel = Record<ApplicationType, MessageDescriptor>;
|
||||
|
||||
const typeToLabel: TypeToLabel = ((Object.keys(typeToForm) as unknown) as Array<ApplicationType>).reduce(
|
||||
const typeToLabel: TypeToLabel = (Object.keys(typeToForm) as unknown as Array<ApplicationType>).reduce(
|
||||
(result, key) => {
|
||||
result[key] = typeToForm[key].label;
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ interface Props {
|
||||
|
||||
const ApplicationTypeSwitcher: ComponentType<Props> = ({ appTypes, selectedType, setType }) => (
|
||||
<div>
|
||||
{((Object.keys(appTypes) as unknown) as Array<ApplicationType>).map((type) => (
|
||||
{(Object.keys(appTypes) as unknown as Array<ApplicationType>).map((type) => (
|
||||
<div className={styles.radioContainer} key={type}>
|
||||
<Radio
|
||||
onChange={() => setType(type)}
|
||||
|
||||
@@ -14,10 +14,11 @@ const FooterMenu: ComponentType = () => {
|
||||
const dispatch = useReduxDispatch();
|
||||
|
||||
const createPopupHandler = useCallback(
|
||||
(popup: ComponentType): MouseEventHandler<HTMLAnchorElement> => (event) => {
|
||||
event.preventDefault();
|
||||
dispatch(createPopup({ Popup: popup }));
|
||||
},
|
||||
(popup: ComponentType): MouseEventHandler<HTMLAnchorElement> =>
|
||||
(event) => {
|
||||
event.preventDefault();
|
||||
dispatch(createPopup({ Popup: popup }));
|
||||
},
|
||||
[dispatch],
|
||||
);
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ import FormInputComponent from './FormInputComponent';
|
||||
type I18nString = string | MessageDescriptor;
|
||||
type ItemLabel = I18nString | React.ReactElement;
|
||||
|
||||
interface Props extends InputHTMLAttributes<HTMLInputElement> {
|
||||
interface Props extends InputHTMLAttributes<HTMLDivElement> {
|
||||
label: I18nString;
|
||||
items: Record<string, ItemLabel>;
|
||||
block?: boolean;
|
||||
|
||||
@@ -39,9 +39,7 @@ export default class FormModel {
|
||||
*
|
||||
* @returns {object} - ref and name props for component
|
||||
*/
|
||||
bindField(
|
||||
name: string,
|
||||
): {
|
||||
bindField(name: string): {
|
||||
name: string;
|
||||
ref: (el: any) => void;
|
||||
error?: ValidationError;
|
||||
|
||||
@@ -27,19 +27,21 @@ const AccountSwitcher: ComponentType<Props> = ({
|
||||
}) => {
|
||||
const available = accounts.filter((account) => account.id !== activeAccount.id);
|
||||
const onAccountClickCallback = useCallback(
|
||||
(account: Account): MouseEventHandler => (event) => {
|
||||
event.preventDefault();
|
||||
onAccountClick(account);
|
||||
},
|
||||
(account: Account): MouseEventHandler =>
|
||||
(event) => {
|
||||
event.preventDefault();
|
||||
onAccountClick(account);
|
||||
},
|
||||
[onAccountClick],
|
||||
);
|
||||
const onAccountRemoveCallback = useCallback(
|
||||
(account: Account): MouseEventHandler => (event) => {
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
(account: Account): MouseEventHandler =>
|
||||
(event) => {
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
|
||||
onRemoveClick(account);
|
||||
},
|
||||
onRemoveClick(account);
|
||||
},
|
||||
[onRemoveClick],
|
||||
);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user