mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-07 08:19:52 +03:00
reate-router 7.0.1
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import { useEffect, useMemo, useState } from 'react';
|
||||
import type { FC } from 'react';
|
||||
import { useLocation } from 'react-router-dom';
|
||||
import { useLocation } from 'react-router';
|
||||
|
||||
import { Box, Toolbar } from '@mui/material';
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { useLocation, useNavigate } from 'react-router-dom';
|
||||
import { useLocation, useNavigate } from 'react-router';
|
||||
|
||||
import ArrowBackIcon from '@mui/icons-material/ArrowBack';
|
||||
import MenuIcon from '@mui/icons-material/Menu';
|
||||
@@ -15,8 +15,7 @@ const LayoutAppBar = ({ title, onToggleDrawer }: LayoutAppBarProps) => {
|
||||
const pathnames = useLocation()
|
||||
.pathname.split('/')
|
||||
.filter((x) => x);
|
||||
const show_back = pathnames.length > 1;
|
||||
|
||||
const back_path = pathnames.length > 1 ? '/' + pathnames[0] : undefined;
|
||||
const navigate = useNavigate();
|
||||
|
||||
return (
|
||||
@@ -39,12 +38,12 @@ const LayoutAppBar = ({ title, onToggleDrawer }: LayoutAppBarProps) => {
|
||||
<MenuIcon />
|
||||
</IconButton>
|
||||
|
||||
{show_back && (
|
||||
{back_path && (
|
||||
<IconButton
|
||||
sx={{ mr: 1 }}
|
||||
color="inherit"
|
||||
edge="start"
|
||||
onClick={() => navigate(pathnames[0])}
|
||||
onClick={() => navigate(back_path)}
|
||||
>
|
||||
<ArrowBackIcon />
|
||||
</IconButton>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { Link, useLocation } from 'react-router-dom';
|
||||
import { Link, useLocation } from 'react-router';
|
||||
|
||||
import { ListItemButton, ListItemIcon, ListItemText } from '@mui/material';
|
||||
import type { SvgIconProps } from '@mui/material';
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { Link } from 'react-router-dom';
|
||||
import { Link } from 'react-router';
|
||||
|
||||
import NavigateNextIcon from '@mui/icons-material/NavigateNext';
|
||||
import {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { Blocker } from 'react-router-dom';
|
||||
import type { Blocker } from 'react-router';
|
||||
|
||||
import {
|
||||
Button,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { useContext } from 'react';
|
||||
import type { FC } from 'react';
|
||||
import { Navigate } from 'react-router-dom';
|
||||
import { Navigate } from 'react-router';
|
||||
|
||||
import { AuthenticatedContext } from 'contexts/authentication';
|
||||
import type { RequiredChildrenProps } from 'utils';
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { useContext, useEffect } from 'react';
|
||||
import type { FC } from 'react';
|
||||
import { Navigate, useLocation } from 'react-router-dom';
|
||||
import { Navigate, useLocation } from 'react-router';
|
||||
|
||||
import { storeLoginRedirect } from 'components/routing/authentication';
|
||||
import type { AuthenticatedContextValue } from 'contexts/authentication/context';
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { useContext } from 'react';
|
||||
import type { FC } from 'react';
|
||||
import { Navigate } from 'react-router-dom';
|
||||
import { Navigate } from 'react-router';
|
||||
|
||||
import { fetchLoginRedirect } from 'components/routing/authentication';
|
||||
import { AuthenticationContext } from 'contexts/authentication';
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import type { FC } from 'react';
|
||||
import { useNavigate } from 'react-router-dom';
|
||||
import { useNavigate } from 'react-router';
|
||||
|
||||
import { Tabs, useMediaQuery, useTheme } from '@mui/material';
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { Path } from 'react-router-dom';
|
||||
import type { Path } from 'react-router';
|
||||
|
||||
import type * as H from 'history';
|
||||
import { jwtDecode } from 'jwt-decode';
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { useMatch, useResolvedPath } from 'react-router-dom';
|
||||
import { useMatch, useResolvedPath } from 'react-router';
|
||||
|
||||
export const useRouterTab = () => {
|
||||
const routerTabPathMatch = useMatch(useResolvedPath(':tab').pathname);
|
||||
|
||||
Reference in New Issue
Block a user