重构鉴权逻辑,新增中间件刷新令牌,授权接口统一后处理无授权跳转
This commit is contained in:
@@ -1,29 +1,13 @@
|
||||
import {ReactNode} from 'react'
|
||||
import {merge} from '@/lib/utils'
|
||||
import {redirect} from 'next/navigation'
|
||||
import {getProfile} from '@/actions/auth/auth'
|
||||
import Header from './_client/header'
|
||||
import Navbar from '@/app/admin/_client/navbar'
|
||||
|
||||
export type DashboardLayoutProps = {
|
||||
export type AdminLayoutProps = {
|
||||
children: ReactNode
|
||||
}
|
||||
|
||||
export default async function DashboardLayout(props: DashboardLayoutProps) {
|
||||
|
||||
// ======================
|
||||
// profile
|
||||
// ======================
|
||||
|
||||
const user = await getProfile()
|
||||
if (!user) {
|
||||
return redirect(`/login?redirect=${encodeURIComponent('/admin')}`)
|
||||
}
|
||||
|
||||
// ======================
|
||||
// render
|
||||
// ======================
|
||||
|
||||
export default async function AdminLayout(props: AdminLayoutProps) {
|
||||
return (
|
||||
<div className={merge(
|
||||
`h-screen bg-card overflow-hidden min-w-7xl overflow-y-hidden`,
|
||||
|
||||
Reference in New Issue
Block a user