feat(admin): add book borrowing dialog and root redirect

- Add admin book borrowing dialog with user selection
- Add useAdminBorrowBook mutation with success/error toasts
- Fix sidebar z-index layering on admin layout
- Add RootRedirect component that routes based on admin role
This commit is contained in:
2026-05-24 20:59:18 +08:00
parent 78ebd0b62e
commit 9780083476
10 changed files with 65 additions and 17 deletions
+2 -1
View File
@@ -20,6 +20,7 @@ import { useAdminBorrows, useSearchBorrows, useAdminReturnBook } from "./hooks"
import { usePlatform } from "@/hooks/usePlatform"
import { useIsMobile } from "@/hooks/useIsMobile"
import { formatDateTime } from "@/lib/formatters"
import { getErrorMessage } from "@/lib/errors"
import type { BorrowInfoVo } from "@/types/api"
export default function AdminBorrowsPage() {
@@ -47,7 +48,7 @@ export default function AdminBorrowsPage() {
if (error) {
return (
<div className="rounded-lg border border-destructive/50 bg-destructive/10 px-4 py-3 text-sm text-destructive">
{error instanceof Error ? error.message : "未知错误"}
{getErrorMessage(error)}
</div>
)
}