mirror of
https://github.com/elyby/accounts-frontend.git
synced 2024-11-08 17:12:25 +05:30
Fix type and lint errors after upgrading corresponding dependencies
This commit is contained in:
parent
404fcb804a
commit
12f5e711c4
@ -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,7 +15,8 @@ interface Props {
|
||||
const AccountSwitcher: ComponentType<Props> = ({ accounts, onAccountClick }) => {
|
||||
const [selectedAccount, setSelectedAccount] = useState<number>();
|
||||
const onAccountClickCallback = useCallback(
|
||||
(account: Account): MouseEventHandler => async (event) => {
|
||||
(account: Account): MouseEventHandler =>
|
||||
async (event) => {
|
||||
event.stopPropagation();
|
||||
|
||||
setSelectedAccount(account.id);
|
||||
|
@ -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,7 +14,8 @@ const FooterMenu: ComponentType = () => {
|
||||
const dispatch = useReduxDispatch();
|
||||
|
||||
const createPopupHandler = useCallback(
|
||||
(popup: ComponentType): MouseEventHandler<HTMLAnchorElement> => (event) => {
|
||||
(popup: ComponentType): MouseEventHandler<HTMLAnchorElement> =>
|
||||
(event) => {
|
||||
event.preventDefault();
|
||||
dispatch(createPopup({ Popup: popup }));
|
||||
},
|
||||
|
@ -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,14 +27,16 @@ const AccountSwitcher: ComponentType<Props> = ({
|
||||
}) => {
|
||||
const available = accounts.filter((account) => account.id !== activeAccount.id);
|
||||
const onAccountClickCallback = useCallback(
|
||||
(account: Account): MouseEventHandler => (event) => {
|
||||
(account: Account): MouseEventHandler =>
|
||||
(event) => {
|
||||
event.preventDefault();
|
||||
onAccountClick(account);
|
||||
},
|
||||
[onAccountClick],
|
||||
);
|
||||
const onAccountRemoveCallback = useCallback(
|
||||
(account: Account): MouseEventHandler => (event) => {
|
||||
(account: Account): MouseEventHandler =>
|
||||
(event) => {
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
|
||||
|
@ -88,9 +88,7 @@ export { default as debounce } from 'debounce';
|
||||
*
|
||||
* @returns {object} - decoded jwt payload
|
||||
*/
|
||||
export function getJwtPayloads(
|
||||
jwt: string,
|
||||
): {
|
||||
export function getJwtPayloads(jwt: string): {
|
||||
sub: string;
|
||||
jti: number;
|
||||
exp: number;
|
||||
|
@ -78,7 +78,9 @@ export default connect(
|
||||
}),
|
||||
{
|
||||
refreshUserData,
|
||||
onSubmit: ({ form, sendData }: { form: FormModel; sendData: () => Promise<any> }) => (dispatch: Dispatch) => {
|
||||
onSubmit:
|
||||
({ form, sendData }: { form: FormModel; sendData: () => Promise<any> }) =>
|
||||
(dispatch: Dispatch) => {
|
||||
form.beginLoading();
|
||||
|
||||
return sendData()
|
||||
|
@ -1,8 +1,6 @@
|
||||
import request, { Resp } from 'app/services/request';
|
||||
|
||||
export function getSecret(
|
||||
id: number,
|
||||
): Promise<
|
||||
export function getSecret(id: number): Promise<
|
||||
Resp<{
|
||||
qr: string;
|
||||
secret: string;
|
||||
|
@ -66,9 +66,7 @@ class I18N {
|
||||
await intlPolyfill('en');
|
||||
}
|
||||
|
||||
async require(
|
||||
locale: string,
|
||||
): Promise<{
|
||||
async require(locale: string): Promise<{
|
||||
locale: string;
|
||||
messages: Record<string, string>;
|
||||
}> {
|
||||
|
@ -267,8 +267,7 @@ async function pull(): Promise<void> {
|
||||
});
|
||||
let downloadingReady = 0;
|
||||
|
||||
const promises = localesToPull.map(
|
||||
async (languageId): Promise<void> => {
|
||||
const promises = localesToPull.map(async (languageId): Promise<void> => {
|
||||
const {
|
||||
data: { url },
|
||||
} = await crowdin.translationsApi.buildProjectFileTranslation(PROJECT_ID, fileId, {
|
||||
@ -284,8 +283,7 @@ async function pull(): Promise<void> {
|
||||
downloadingProgressBar.update(++downloadingReady / localesToPull.length, {
|
||||
cCurrent: downloadingReady,
|
||||
});
|
||||
},
|
||||
);
|
||||
});
|
||||
|
||||
await Promise.all(promises);
|
||||
|
||||
|
@ -12,13 +12,15 @@ module.exports = ({ webpackLoaderContext: loader }) => ({
|
||||
'postcss-import': {
|
||||
addModulesDirectories: ['./src'],
|
||||
|
||||
resolve: ((defaultResolve) => (url, basedir, importOptions) =>
|
||||
resolve: (
|
||||
(defaultResolve) => (url, basedir, importOptions) =>
|
||||
defaultResolve(
|
||||
// mainly to remove '~' from request
|
||||
loaderUtils.urlToRequest(url),
|
||||
basedir,
|
||||
importOptions,
|
||||
))(require('postcss-import/lib/resolve-id')),
|
||||
)
|
||||
)(require('postcss-import/lib/resolve-id')),
|
||||
|
||||
load: ((defaultLoad) => (filename, importOptions) => {
|
||||
if (/\.font.(js|json)$/.test(filename)) {
|
||||
|
@ -240,8 +240,7 @@ function createState() {
|
||||
id: 7,
|
||||
username: 'SleepWalker',
|
||||
email: 'danilenkos@auroraglobal.com',
|
||||
token:
|
||||
'eyJhbGciOiJIUzI1NiJ9.eyJlbHktc2NvcGVzIjoiYWNjb3VudHNfd2ViX3VzZXIiLCJpYXQiOjE1MTgzNzM4MDksImV4cCI6MTUxODM3NzQwOSwic3ViIjoiZWx5fDciLCJqdGkiOjM1NDh9.Fv4AbJ0iDbrH3bhbgF0ViJLfYYiwH78deR4fMlMhKrQ',
|
||||
token: 'eyJhbGciOiJIUzI1NiJ9.eyJlbHktc2NvcGVzIjoiYWNjb3VudHNfd2ViX3VzZXIiLCJpYXQiOjE1MTgzNzM4MDksImV4cCI6MTUxODM3NzQwOSwic3ViIjoiZWx5fDciLCJqdGkiOjM1NDh9.Fv4AbJ0iDbrH3bhbgF0ViJLfYYiwH78deR4fMlMhKrQ',
|
||||
refreshToken:
|
||||
'3gh6ZZ3R9jGeFdp0TmlY7sd0zBxH6Zfq48M86eUAv952RcAKx32RAnjlKkgd6i-MV-RKbjtADIdoRwMUWOYQjEYtwwXPjcQJ',
|
||||
},
|
||||
@ -249,8 +248,7 @@ function createState() {
|
||||
id: 102,
|
||||
username: 'test',
|
||||
email: 'admin@udf.su',
|
||||
token:
|
||||
'eyJhbGciOiJIUzI1NiJ9.eyJlbHktc2NvcGVzIjoiYWNjb3VudHNfd2ViX3VzZXIiLCJpYXQiOjE1MTgzNzM4NjUsImV4cCI6MTUxODM3NzQ2NSwic3ViIjoiZWx5fDEwMiIsImp0aSI6MzU0OX0.eJEgvXT3leGqBe3tYNGZb0E4WEvWfrLPjcD7eNjyQYO',
|
||||
token: 'eyJhbGciOiJIUzI1NiJ9.eyJlbHktc2NvcGVzIjoiYWNjb3VudHNfd2ViX3VzZXIiLCJpYXQiOjE1MTgzNzM4NjUsImV4cCI6MTUxODM3NzQ2NSwic3ViIjoiZWx5fDEwMiIsImp0aSI6MzU0OX0.eJEgvXT3leGqBe3tYNGZb0E4WEvWfrLPjcD7eNjyQYO',
|
||||
refreshToken:
|
||||
'Al75SIx-LFOCP7kaqZBVqMVmSljJw9_bdFQGyuM64c6ShP7YsXbkCD8vPOundAwUDfRZqsIbOHUROmAHPB0VBfjLfw96yqxx',
|
||||
},
|
||||
|
@ -6,7 +6,7 @@ describe('Applications', () => {
|
||||
|
||||
// remove all previously added apps
|
||||
cy.window().then(async (win) => {
|
||||
const { oauthApi } = (win as any) as {
|
||||
const { oauthApi } = win as any as {
|
||||
oauthApi: typeof import('app/services/api/oauth').default;
|
||||
};
|
||||
const apps = await oauthApi.getAppsByUser(user.id);
|
||||
|
6
tests-e2e/cypress/support/index.d.ts
vendored
6
tests-e2e/cypress/support/index.d.ts
vendored
@ -32,11 +32,7 @@ declare namespace Cypress {
|
||||
*/
|
||||
rawApiResp?: false;
|
||||
}): Promise<{ accounts: TAccount[] }>;
|
||||
login(options: {
|
||||
accounts: AccountAlias[];
|
||||
updateState?: boolean;
|
||||
rawApiResp: true;
|
||||
}): Promise<{
|
||||
login(options: { accounts: AccountAlias[]; updateState?: boolean; rawApiResp: true }): Promise<{
|
||||
accounts: {
|
||||
success: true;
|
||||
access_token: string;
|
||||
|
Loading…
Reference in New Issue
Block a user