perf: 聊天页优化

perf: md解析样式

perf: ui调整

perf: 懒加载和动态加载优化

perf: 去除console,

perf: 图片cdn

feat: 图片地址

perf: 登录顺序

feat: 流优化
This commit is contained in:
Archer
2023-03-09 20:44:13 +08:00
parent 2390823282
commit 17364e9da3
47 changed files with 1384 additions and 852 deletions

View File

@@ -7,6 +7,7 @@ import { useGlobalStore } from '@/store/global';
import { useQuery } from '@tanstack/react-query';
const unAuthPage: { [key: string]: boolean } = {
'/': true,
'/login': true,
'/chat': true
};
@@ -24,10 +25,10 @@ const Auth = ({ children }: { children: JSX.Element }) => {
useQuery(
[router.pathname, userInfo],
() => {
setLoading(true);
if (unAuthPage[router.pathname] === true || userInfo) {
return setLoading(false);
} else {
setLoading(true);
return getTokenLogin();
}
},
@@ -38,7 +39,7 @@ const Auth = ({ children }: { children: JSX.Element }) => {
}
},
onError(error) {
console.log(error);
console.error(error);
router.push('/login');
toast();
},
@@ -48,7 +49,7 @@ const Auth = ({ children }: { children: JSX.Element }) => {
}
);
return userInfo || unAuthPage[router.pathname] === true ? <>{children}</> : null;
return userInfo || unAuthPage[router.pathname] === true ? children : null;
};
export default Auth;