From 775062a50958a2565ca9d8f4d72c26406e3ef19d Mon Sep 17 00:00:00 2001 From: Anastasiia Date: Thu, 25 Apr 2024 13:53:46 +0300 Subject: [PATCH] MSP-3229 replace part of 'any' --- src/components/Layout/index.tsx | 3 ++- src/pages/LoginPage/index.tsx | 2 +- src/pages/RolesPage/index.tsx | 2 +- src/pages/UsersPage/index.tsx | 2 +- 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/components/Layout/index.tsx b/src/components/Layout/index.tsx index bd583c9..9da420c 100644 --- a/src/components/Layout/index.tsx +++ b/src/components/Layout/index.tsx @@ -6,6 +6,7 @@ import { ProfileOutlined } from '@ant-design/icons' import { ConfigProvider, Layout, Menu, Spin } from 'antd' +import type { MenuProps } from 'antd' import { useContext, useEffect, useState } from 'react' import { Navigate, Outlet, useLocation, useNavigate } from 'react-router-dom' @@ -166,7 +167,7 @@ const LayoutComponent = () => { } }, [location]) - const handlerOnClickMenu = ({ key }: any): void => { + const handlerOnClickMenu: MenuProps['onClick'] = ({ key }): void => { switch (key) { case MenuItemKeysType.logout: { logoutUser() diff --git a/src/pages/LoginPage/index.tsx b/src/pages/LoginPage/index.tsx index f4826df..d6aa488 100644 --- a/src/pages/LoginPage/index.tsx +++ b/src/pages/LoginPage/index.tsx @@ -61,7 +61,7 @@ const LoginPage = () => { navigate(redirectUrl, { replace: true }) localStorage.removeItem('redirectUrl') }) - .catch((err: any) => handleError(err)) + .catch((err: AxiosError) => handleError(err)) } const renderInternalAuthForm = () => { diff --git a/src/pages/RolesPage/index.tsx b/src/pages/RolesPage/index.tsx index 689c02b..c0933ed 100644 --- a/src/pages/RolesPage/index.tsx +++ b/src/pages/RolesPage/index.tsx @@ -111,7 +111,7 @@ const RolesPage = () => { }) } - const handleRemoveRole = (id: any) => { + const handleRemoveRole = (id: string) => { const idAsNumber = parseInt(id, 10) removeRole(idAsNumber) .unwrap() diff --git a/src/pages/UsersPage/index.tsx b/src/pages/UsersPage/index.tsx index fa18116..811a740 100644 --- a/src/pages/UsersPage/index.tsx +++ b/src/pages/UsersPage/index.tsx @@ -105,7 +105,7 @@ const UsersPage = () => { dataIndex: 'roles', key: 'roles', render: (values: number[]) => { - const labels: any[] = [] + const labels: string[] = [] values.forEach((value: number) => { const roleLabel = roles?.find((el) => el.id === value) if (roleLabel) {