重构鉴权逻辑,新增中间件刷新令牌,授权接口统一后处理无授权跳转

This commit is contained in:
2025-04-26 14:18:08 +08:00
parent 5c88cd7f32
commit 6db037204c
20 changed files with 303 additions and 318 deletions

View File

@@ -1,18 +1,21 @@
'use server'
import {ReactNode} from 'react'
import {Metadata} from 'next'
import './globals.css'
import localFont from 'next/font/local'
import {Toaster} from '@/components/ui/sonner'
import StoreProvider from '@/components/providers/StoreProvider'
import {getProfile} from '@/actions/auth/auth'
import {getProfile} from '@/actions/auth'
const font = localFont({
src: './NotoSansSC-VariableFont_wght.ttf',
})
export const metadata: Metadata = {
title: 'Create Next App',
description: 'Generated by create next app',
export async function generateMetadata(): Promise<Metadata> {
return {
title: 'Create Next App',
description: 'Generated by create next app',
}
}
export default async function RootLayout({
@@ -21,7 +24,8 @@ export default async function RootLayout({
children: ReactNode
}>) {
const user = await getProfile()
const result = await getProfile()
const user = result.success ? result.data : null
return (
<html lang="zh-CN">