完整性更新
现在已经实现了大部分基础功能
This commit is contained in:
21
src/app/(dashboard)/settings/page.tsx
Normal file
21
src/app/(dashboard)/settings/page.tsx
Normal file
@@ -0,0 +1,21 @@
|
||||
import { redirect } from "next/navigation"
|
||||
|
||||
import { auth } from "@/auth"
|
||||
import { AdminSettingsView } from "@/modules/settings/components/admin-settings-view"
|
||||
import { StudentSettingsView } from "@/modules/settings/components/student-settings-view"
|
||||
import { TeacherSettingsView } from "@/modules/settings/components/teacher-settings-view"
|
||||
|
||||
export const dynamic = "force-dynamic"
|
||||
|
||||
export default async function SettingsPage() {
|
||||
const session = await auth()
|
||||
if (!session?.user) redirect("/login")
|
||||
|
||||
const role = String(session.user.role ?? "teacher")
|
||||
|
||||
if (role === "admin") return <AdminSettingsView />
|
||||
if (role === "student") return <StudentSettingsView user={session.user} />
|
||||
if (role === "teacher") return <TeacherSettingsView user={session.user} />
|
||||
|
||||
redirect("/dashboard")
|
||||
}
|
||||
Reference in New Issue
Block a user