mirror of
https://github.com/elyby/accounts-frontend.git
synced 2024-11-26 16:52:06 +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 {
|
try {
|
||||||
const { token: newToken, refreshToken: newRefreshToken, user } = await validateToken(
|
const {
|
||||||
accountId,
|
token: newToken,
|
||||||
token,
|
refreshToken: newRefreshToken,
|
||||||
refreshToken,
|
user,
|
||||||
);
|
} = await validateToken(accountId, token, refreshToken);
|
||||||
const newAccount: Account = {
|
const newAccount: Account = {
|
||||||
id: user.id,
|
id: user.id,
|
||||||
username: user.username,
|
username: user.username,
|
||||||
|
@ -405,7 +405,7 @@ class PanelTransition extends React.PureComponent<Props, State> {
|
|||||||
|
|
||||||
getHeader({ key, style, data }: TransitionPlainStyle): ReactElement {
|
getHeader({ key, style, data }: TransitionPlainStyle): ReactElement {
|
||||||
const { Title } = data as AnimationData;
|
const { Title } = data as AnimationData;
|
||||||
const { transformSpring } = (style as unknown) as AnimationStyle;
|
const { transformSpring } = style as unknown as AnimationStyle;
|
||||||
|
|
||||||
let { hasBackButton } = data;
|
let { hasBackButton } = data;
|
||||||
|
|
||||||
@ -414,7 +414,7 @@ class PanelTransition extends React.PureComponent<Props, State> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const transitionStyle = {
|
const transitionStyle = {
|
||||||
...this.getDefaultTransitionStyles(key, (style as unknown) as AnimationStyle),
|
...this.getDefaultTransitionStyles(key, style as unknown as AnimationStyle),
|
||||||
opacity: 1, // reset default
|
opacity: 1, // reset default
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -448,7 +448,7 @@ class PanelTransition extends React.PureComponent<Props, State> {
|
|||||||
|
|
||||||
getBody({ key, style, data }: TransitionPlainStyle): ReactElement {
|
getBody({ key, style, data }: TransitionPlainStyle): ReactElement {
|
||||||
const { Body } = data as AnimationData;
|
const { Body } = data as AnimationData;
|
||||||
const { transformSpring } = (style as unknown) as AnimationStyle;
|
const { transformSpring } = style as unknown as AnimationStyle;
|
||||||
const { direction } = this.state;
|
const { direction } = this.state;
|
||||||
|
|
||||||
let transform = this.translate(transformSpring, direction);
|
let transform = this.translate(transformSpring, direction);
|
||||||
@ -460,7 +460,7 @@ class PanelTransition extends React.PureComponent<Props, State> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const transitionStyle: CSSProperties = {
|
const transitionStyle: CSSProperties = {
|
||||||
...this.getDefaultTransitionStyles(key, (style as unknown) as AnimationStyle),
|
...this.getDefaultTransitionStyles(key, style as unknown as AnimationStyle),
|
||||||
top: 'auto', // reset default
|
top: 'auto', // reset default
|
||||||
[verticalOrigin]: 0,
|
[verticalOrigin]: 0,
|
||||||
...transform,
|
...transform,
|
||||||
@ -486,7 +486,7 @@ class PanelTransition extends React.PureComponent<Props, State> {
|
|||||||
getFooter({ key, style, data }: TransitionPlainStyle): ReactElement {
|
getFooter({ key, style, data }: TransitionPlainStyle): ReactElement {
|
||||||
const { Footer } = data as AnimationData;
|
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 (
|
return (
|
||||||
<div key={`footer/${key}`} style={transitionStyle}>
|
<div key={`footer/${key}`} style={transitionStyle}>
|
||||||
@ -498,7 +498,7 @@ class PanelTransition extends React.PureComponent<Props, State> {
|
|||||||
getLinks({ key, style, data }: TransitionPlainStyle): ReactElement {
|
getLinks({ key, style, data }: TransitionPlainStyle): ReactElement {
|
||||||
const { Links } = data as AnimationData;
|
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 (
|
return (
|
||||||
<div key={`links/${key}`} style={transitionStyle}>
|
<div key={`links/${key}`} style={transitionStyle}>
|
||||||
|
@ -15,7 +15,8 @@ interface Props {
|
|||||||
const AccountSwitcher: ComponentType<Props> = ({ accounts, onAccountClick }) => {
|
const AccountSwitcher: ComponentType<Props> = ({ accounts, onAccountClick }) => {
|
||||||
const [selectedAccount, setSelectedAccount] = useState<number>();
|
const [selectedAccount, setSelectedAccount] = useState<number>();
|
||||||
const onAccountClickCallback = useCallback(
|
const onAccountClickCallback = useCallback(
|
||||||
(account: Account): MouseEventHandler => async (event) => {
|
(account: Account): MouseEventHandler =>
|
||||||
|
async (event) => {
|
||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
|
|
||||||
setSelectedAccount(account.id);
|
setSelectedAccount(account.id);
|
||||||
|
@ -44,7 +44,7 @@ const typeToForm: TypeToForm = {
|
|||||||
|
|
||||||
type TypeToLabel = Record<ApplicationType, MessageDescriptor>;
|
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) => {
|
||||||
result[key] = typeToForm[key].label;
|
result[key] = typeToForm[key].label;
|
||||||
|
|
||||||
|
@ -14,7 +14,7 @@ interface Props {
|
|||||||
|
|
||||||
const ApplicationTypeSwitcher: ComponentType<Props> = ({ appTypes, selectedType, setType }) => (
|
const ApplicationTypeSwitcher: ComponentType<Props> = ({ appTypes, selectedType, setType }) => (
|
||||||
<div>
|
<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}>
|
<div className={styles.radioContainer} key={type}>
|
||||||
<Radio
|
<Radio
|
||||||
onChange={() => setType(type)}
|
onChange={() => setType(type)}
|
||||||
|
@ -14,7 +14,8 @@ const FooterMenu: ComponentType = () => {
|
|||||||
const dispatch = useReduxDispatch();
|
const dispatch = useReduxDispatch();
|
||||||
|
|
||||||
const createPopupHandler = useCallback(
|
const createPopupHandler = useCallback(
|
||||||
(popup: ComponentType): MouseEventHandler<HTMLAnchorElement> => (event) => {
|
(popup: ComponentType): MouseEventHandler<HTMLAnchorElement> =>
|
||||||
|
(event) => {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
dispatch(createPopup({ Popup: popup }));
|
dispatch(createPopup({ Popup: popup }));
|
||||||
},
|
},
|
||||||
|
@ -11,7 +11,7 @@ import FormInputComponent from './FormInputComponent';
|
|||||||
type I18nString = string | MessageDescriptor;
|
type I18nString = string | MessageDescriptor;
|
||||||
type ItemLabel = I18nString | React.ReactElement;
|
type ItemLabel = I18nString | React.ReactElement;
|
||||||
|
|
||||||
interface Props extends InputHTMLAttributes<HTMLInputElement> {
|
interface Props extends InputHTMLAttributes<HTMLDivElement> {
|
||||||
label: I18nString;
|
label: I18nString;
|
||||||
items: Record<string, ItemLabel>;
|
items: Record<string, ItemLabel>;
|
||||||
block?: boolean;
|
block?: boolean;
|
||||||
|
@ -39,9 +39,7 @@ export default class FormModel {
|
|||||||
*
|
*
|
||||||
* @returns {object} - ref and name props for component
|
* @returns {object} - ref and name props for component
|
||||||
*/
|
*/
|
||||||
bindField(
|
bindField(name: string): {
|
||||||
name: string,
|
|
||||||
): {
|
|
||||||
name: string;
|
name: string;
|
||||||
ref: (el: any) => void;
|
ref: (el: any) => void;
|
||||||
error?: ValidationError;
|
error?: ValidationError;
|
||||||
|
@ -27,14 +27,16 @@ const AccountSwitcher: ComponentType<Props> = ({
|
|||||||
}) => {
|
}) => {
|
||||||
const available = accounts.filter((account) => account.id !== activeAccount.id);
|
const available = accounts.filter((account) => account.id !== activeAccount.id);
|
||||||
const onAccountClickCallback = useCallback(
|
const onAccountClickCallback = useCallback(
|
||||||
(account: Account): MouseEventHandler => (event) => {
|
(account: Account): MouseEventHandler =>
|
||||||
|
(event) => {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
onAccountClick(account);
|
onAccountClick(account);
|
||||||
},
|
},
|
||||||
[onAccountClick],
|
[onAccountClick],
|
||||||
);
|
);
|
||||||
const onAccountRemoveCallback = useCallback(
|
const onAccountRemoveCallback = useCallback(
|
||||||
(account: Account): MouseEventHandler => (event) => {
|
(account: Account): MouseEventHandler =>
|
||||||
|
(event) => {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
|
|
||||||
|
@ -88,9 +88,7 @@ export { default as debounce } from 'debounce';
|
|||||||
*
|
*
|
||||||
* @returns {object} - decoded jwt payload
|
* @returns {object} - decoded jwt payload
|
||||||
*/
|
*/
|
||||||
export function getJwtPayloads(
|
export function getJwtPayloads(jwt: string): {
|
||||||
jwt: string,
|
|
||||||
): {
|
|
||||||
sub: string;
|
sub: string;
|
||||||
jti: number;
|
jti: number;
|
||||||
exp: number;
|
exp: number;
|
||||||
|
@ -78,7 +78,9 @@ export default connect(
|
|||||||
}),
|
}),
|
||||||
{
|
{
|
||||||
refreshUserData,
|
refreshUserData,
|
||||||
onSubmit: ({ form, sendData }: { form: FormModel; sendData: () => Promise<any> }) => (dispatch: Dispatch) => {
|
onSubmit:
|
||||||
|
({ form, sendData }: { form: FormModel; sendData: () => Promise<any> }) =>
|
||||||
|
(dispatch: Dispatch) => {
|
||||||
form.beginLoading();
|
form.beginLoading();
|
||||||
|
|
||||||
return sendData()
|
return sendData()
|
||||||
|
@ -1,8 +1,6 @@
|
|||||||
import request, { Resp } from 'app/services/request';
|
import request, { Resp } from 'app/services/request';
|
||||||
|
|
||||||
export function getSecret(
|
export function getSecret(id: number): Promise<
|
||||||
id: number,
|
|
||||||
): Promise<
|
|
||||||
Resp<{
|
Resp<{
|
||||||
qr: string;
|
qr: string;
|
||||||
secret: string;
|
secret: string;
|
||||||
|
@ -66,9 +66,7 @@ class I18N {
|
|||||||
await intlPolyfill('en');
|
await intlPolyfill('en');
|
||||||
}
|
}
|
||||||
|
|
||||||
async require(
|
async require(locale: string): Promise<{
|
||||||
locale: string,
|
|
||||||
): Promise<{
|
|
||||||
locale: string;
|
locale: string;
|
||||||
messages: Record<string, string>;
|
messages: Record<string, string>;
|
||||||
}> {
|
}> {
|
||||||
|
@ -267,8 +267,7 @@ async function pull(): Promise<void> {
|
|||||||
});
|
});
|
||||||
let downloadingReady = 0;
|
let downloadingReady = 0;
|
||||||
|
|
||||||
const promises = localesToPull.map(
|
const promises = localesToPull.map(async (languageId): Promise<void> => {
|
||||||
async (languageId): Promise<void> => {
|
|
||||||
const {
|
const {
|
||||||
data: { url },
|
data: { url },
|
||||||
} = await crowdin.translationsApi.buildProjectFileTranslation(PROJECT_ID, fileId, {
|
} = await crowdin.translationsApi.buildProjectFileTranslation(PROJECT_ID, fileId, {
|
||||||
@ -284,8 +283,7 @@ async function pull(): Promise<void> {
|
|||||||
downloadingProgressBar.update(++downloadingReady / localesToPull.length, {
|
downloadingProgressBar.update(++downloadingReady / localesToPull.length, {
|
||||||
cCurrent: downloadingReady,
|
cCurrent: downloadingReady,
|
||||||
});
|
});
|
||||||
},
|
});
|
||||||
);
|
|
||||||
|
|
||||||
await Promise.all(promises);
|
await Promise.all(promises);
|
||||||
|
|
||||||
|
@ -12,13 +12,15 @@ module.exports = ({ webpackLoaderContext: loader }) => ({
|
|||||||
'postcss-import': {
|
'postcss-import': {
|
||||||
addModulesDirectories: ['./src'],
|
addModulesDirectories: ['./src'],
|
||||||
|
|
||||||
resolve: ((defaultResolve) => (url, basedir, importOptions) =>
|
resolve: (
|
||||||
|
(defaultResolve) => (url, basedir, importOptions) =>
|
||||||
defaultResolve(
|
defaultResolve(
|
||||||
// mainly to remove '~' from request
|
// mainly to remove '~' from request
|
||||||
loaderUtils.urlToRequest(url),
|
loaderUtils.urlToRequest(url),
|
||||||
basedir,
|
basedir,
|
||||||
importOptions,
|
importOptions,
|
||||||
))(require('postcss-import/lib/resolve-id')),
|
)
|
||||||
|
)(require('postcss-import/lib/resolve-id')),
|
||||||
|
|
||||||
load: ((defaultLoad) => (filename, importOptions) => {
|
load: ((defaultLoad) => (filename, importOptions) => {
|
||||||
if (/\.font.(js|json)$/.test(filename)) {
|
if (/\.font.(js|json)$/.test(filename)) {
|
||||||
|
@ -240,8 +240,7 @@ function createState() {
|
|||||||
id: 7,
|
id: 7,
|
||||||
username: 'SleepWalker',
|
username: 'SleepWalker',
|
||||||
email: 'danilenkos@auroraglobal.com',
|
email: 'danilenkos@auroraglobal.com',
|
||||||
token:
|
token: 'eyJhbGciOiJIUzI1NiJ9.eyJlbHktc2NvcGVzIjoiYWNjb3VudHNfd2ViX3VzZXIiLCJpYXQiOjE1MTgzNzM4MDksImV4cCI6MTUxODM3NzQwOSwic3ViIjoiZWx5fDciLCJqdGkiOjM1NDh9.Fv4AbJ0iDbrH3bhbgF0ViJLfYYiwH78deR4fMlMhKrQ',
|
||||||
'eyJhbGciOiJIUzI1NiJ9.eyJlbHktc2NvcGVzIjoiYWNjb3VudHNfd2ViX3VzZXIiLCJpYXQiOjE1MTgzNzM4MDksImV4cCI6MTUxODM3NzQwOSwic3ViIjoiZWx5fDciLCJqdGkiOjM1NDh9.Fv4AbJ0iDbrH3bhbgF0ViJLfYYiwH78deR4fMlMhKrQ',
|
|
||||||
refreshToken:
|
refreshToken:
|
||||||
'3gh6ZZ3R9jGeFdp0TmlY7sd0zBxH6Zfq48M86eUAv952RcAKx32RAnjlKkgd6i-MV-RKbjtADIdoRwMUWOYQjEYtwwXPjcQJ',
|
'3gh6ZZ3R9jGeFdp0TmlY7sd0zBxH6Zfq48M86eUAv952RcAKx32RAnjlKkgd6i-MV-RKbjtADIdoRwMUWOYQjEYtwwXPjcQJ',
|
||||||
},
|
},
|
||||||
@ -249,8 +248,7 @@ function createState() {
|
|||||||
id: 102,
|
id: 102,
|
||||||
username: 'test',
|
username: 'test',
|
||||||
email: 'admin@udf.su',
|
email: 'admin@udf.su',
|
||||||
token:
|
token: 'eyJhbGciOiJIUzI1NiJ9.eyJlbHktc2NvcGVzIjoiYWNjb3VudHNfd2ViX3VzZXIiLCJpYXQiOjE1MTgzNzM4NjUsImV4cCI6MTUxODM3NzQ2NSwic3ViIjoiZWx5fDEwMiIsImp0aSI6MzU0OX0.eJEgvXT3leGqBe3tYNGZb0E4WEvWfrLPjcD7eNjyQYO',
|
||||||
'eyJhbGciOiJIUzI1NiJ9.eyJlbHktc2NvcGVzIjoiYWNjb3VudHNfd2ViX3VzZXIiLCJpYXQiOjE1MTgzNzM4NjUsImV4cCI6MTUxODM3NzQ2NSwic3ViIjoiZWx5fDEwMiIsImp0aSI6MzU0OX0.eJEgvXT3leGqBe3tYNGZb0E4WEvWfrLPjcD7eNjyQYO',
|
|
||||||
refreshToken:
|
refreshToken:
|
||||||
'Al75SIx-LFOCP7kaqZBVqMVmSljJw9_bdFQGyuM64c6ShP7YsXbkCD8vPOundAwUDfRZqsIbOHUROmAHPB0VBfjLfw96yqxx',
|
'Al75SIx-LFOCP7kaqZBVqMVmSljJw9_bdFQGyuM64c6ShP7YsXbkCD8vPOundAwUDfRZqsIbOHUROmAHPB0VBfjLfw96yqxx',
|
||||||
},
|
},
|
||||||
|
@ -6,7 +6,7 @@ describe('Applications', () => {
|
|||||||
|
|
||||||
// remove all previously added apps
|
// remove all previously added apps
|
||||||
cy.window().then(async (win) => {
|
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;
|
oauthApi: typeof import('app/services/api/oauth').default;
|
||||||
};
|
};
|
||||||
const apps = await oauthApi.getAppsByUser(user.id);
|
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;
|
rawApiResp?: false;
|
||||||
}): Promise<{ accounts: TAccount[] }>;
|
}): Promise<{ accounts: TAccount[] }>;
|
||||||
login(options: {
|
login(options: { accounts: AccountAlias[]; updateState?: boolean; rawApiResp: true }): Promise<{
|
||||||
accounts: AccountAlias[];
|
|
||||||
updateState?: boolean;
|
|
||||||
rawApiResp: true;
|
|
||||||
}): Promise<{
|
|
||||||
accounts: {
|
accounts: {
|
||||||
success: true;
|
success: true;
|
||||||
access_token: string;
|
access_token: string;
|
||||||
|
Loading…
Reference in New Issue
Block a user