File tree Expand file tree Collapse file tree 3 files changed +2
-11
lines changed
Expand file tree Collapse file tree 3 files changed +2
-11
lines changed Original file line number Diff line number Diff line change @@ -40,7 +40,7 @@ async def paginate(
4040 stmt = stmt .offset (offset ).limit (size )
4141
4242 result = self .session .exec (stmt )
43- items = result .all () # 移除 scalars() 调用,直接使用 all()
43+ items = result .all ()
4444
4545 return items , total
4646
Original file line number Diff line number Diff line change 11import { ElMessage } from 'element-plus'
22import { useCache } from '@/utils/useCache'
33const { wsCache } = useCache ( )
4- // 不需要验证token的白名单路由
54const whiteList = [ '/login' ]
65export const watchRouter = ( router : any ) => {
76 router . beforeEach ( async ( to : any , from : any , next : any ) => {
8- // 获取token
97 const token = wsCache . get ( 'user.token' )
10- // 如果没有token
118 if ( ! token ) {
129 if ( whiteList . includes ( to . path ) ) {
1310 next ( )
1411 } else {
15- ElMessage . error ( '请先登录 ' )
12+ ElMessage . error ( 'Please login first ' )
1613 next ( '/login' )
1714 }
1815 return
1916 }
20- // 处理根路径重定向
2117 if ( to . path === '/' ) {
2218 next ( '/chat' )
2319 return
2420 }
25- // 已有token和用户信息,允许访问
2621 if ( to . path === '/login' ) {
2722 next ( '/chat' )
2823 } else {
Original file line number Diff line number Diff line change 1- /**
2- * 配置浏览器本地存储的方式,可直接存储对象数组。
3- */
4-
51import WebStorageCache from 'web-storage-cache'
62
73type CacheType = 'sessionStorage' | 'localStorage'
You can’t perform that action at this time.
0 commit comments