mirror of
https://github.com/PlayEdu/h5.git
synced 2025-12-25 16:00:26 +08:00
项目初始化
This commit is contained in:
4
src/components/empty/index.module.scss
Normal file
4
src/components/empty/index.module.scss
Normal file
@@ -0,0 +1,4 @@
|
||||
.img-box {
|
||||
width: 100%;
|
||||
height: auto;
|
||||
}
|
||||
12
src/components/empty/index.tsx
Normal file
12
src/components/empty/index.tsx
Normal file
@@ -0,0 +1,12 @@
|
||||
import styles from "./index.module.scss";
|
||||
import React from "react";
|
||||
import { Image } from "antd-mobile";
|
||||
import empty from "../../assets/images/commen/empty.png";
|
||||
|
||||
export const Empty: React.FC = () => {
|
||||
return (
|
||||
<div className={styles["img-box"]}>
|
||||
<Image src={empty} width={400} height={400} />
|
||||
</div>
|
||||
);
|
||||
};
|
||||
1
src/components/index.ts
Normal file
1
src/components/index.ts
Normal file
@@ -0,0 +1 @@
|
||||
export * from "./empty"
|
||||
12
src/components/private-route/index.tsx
Normal file
12
src/components/private-route/index.tsx
Normal file
@@ -0,0 +1,12 @@
|
||||
import React from "react";
|
||||
import { getToken } from "../../utils/index";
|
||||
import { Navigate } from "react-router-dom";
|
||||
|
||||
interface PropInterface {
|
||||
Component: any;
|
||||
}
|
||||
|
||||
const PrivateRoute: React.FC<PropInterface> = ({ Component }) => {
|
||||
return getToken() ? Component : <Navigate to="/login" replace={true} />;
|
||||
};
|
||||
export default PrivateRoute;
|
||||
Reference in New Issue
Block a user