mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-08 00:39:50 +03:00
new linting, make sure code is type safe
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import { Button, Dialog, DialogActions, DialogContent, DialogTitle } from '@mui/material';
|
||||
import type { FC } from 'react';
|
||||
import type { Blocker } from 'react-router-dom';
|
||||
|
||||
import type { unstable_Blocker as Blocker } from 'react-router-dom';
|
||||
import { Button, Dialog, DialogActions, DialogContent, DialogTitle } from '@mui/material';
|
||||
|
||||
import { dialogStyle } from 'CustomTheme';
|
||||
import { useI18nContext } from 'i18n/i18n-react';
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import { useContext } from 'react';
|
||||
import { Navigate } from 'react-router-dom';
|
||||
import type { FC } from 'react';
|
||||
import { Navigate } from 'react-router-dom';
|
||||
|
||||
import type { RequiredChildrenProps } from 'utils';
|
||||
import { AuthenticatedContext } from 'contexts/authentication';
|
||||
import type { RequiredChildrenProps } from 'utils';
|
||||
|
||||
const RequireAdmin: FC<RequiredChildrenProps> = ({ children }) => {
|
||||
const authenticatedContext = useContext(AuthenticatedContext);
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
import { useContext, useEffect } from 'react';
|
||||
import type { FC } from 'react';
|
||||
import { Navigate, useLocation } from 'react-router-dom';
|
||||
|
||||
import type { AuthenticatedContextValue } from 'contexts/authentication/context';
|
||||
import type { FC } from 'react';
|
||||
|
||||
import type { RequiredChildrenProps } from 'utils';
|
||||
import { storeLoginRedirect } from 'api/authentication';
|
||||
|
||||
import type { AuthenticatedContextValue } from 'contexts/authentication/context';
|
||||
import { AuthenticatedContext, AuthenticationContext } from 'contexts/authentication/context';
|
||||
import type { RequiredChildrenProps } from 'utils';
|
||||
|
||||
const RequireAuthenticated: FC<RequiredChildrenProps> = ({ children }) => {
|
||||
const authenticationContext = useContext(AuthenticationContext);
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
import { useContext } from 'react';
|
||||
import { Navigate } from 'react-router-dom';
|
||||
import type { FC } from 'react';
|
||||
import { Navigate } from 'react-router-dom';
|
||||
|
||||
import type { RequiredChildrenProps } from 'utils';
|
||||
import * as AuthenticationApi from 'api/authentication';
|
||||
|
||||
import { AuthenticationContext } from 'contexts/authentication';
|
||||
import type { RequiredChildrenProps } from 'utils';
|
||||
|
||||
const RequireUnauthenticated: FC<RequiredChildrenProps> = ({ children }) => {
|
||||
const authenticationContext = useContext(AuthenticationContext);
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { Tabs, useMediaQuery, useTheme } from '@mui/material';
|
||||
import { useNavigate } from 'react-router-dom';
|
||||
import type { FC } from 'react';
|
||||
import { useNavigate } from 'react-router-dom';
|
||||
|
||||
import { Tabs, useMediaQuery, useTheme } from '@mui/material';
|
||||
|
||||
import type { RequiredChildrenProps } from 'utils';
|
||||
|
||||
@@ -14,7 +15,7 @@ const RouterTabs: FC<RouterTabsProps> = ({ value, children }) => {
|
||||
const theme = useTheme();
|
||||
const smallDown = useMediaQuery(theme.breakpoints.down('sm'));
|
||||
|
||||
const handleTabChange = (_event: any, path: string) => {
|
||||
const handleTabChange = (_event: unknown, path: string) => {
|
||||
navigate(path);
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user