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:
@@ -1,6 +1,7 @@
|
||||
import { useQuery, useMutation, useQueryClient } from "@tanstack/react-query"
|
||||
import { getAllMyBorrows, returnBookForMe } from "@/api/borrows"
|
||||
import { toast } from "sonner"
|
||||
import { getErrorMessage } from "@/lib/errors"
|
||||
|
||||
export function useMyBorrows() {
|
||||
return useQuery({
|
||||
@@ -18,7 +19,7 @@ export function useReturnBook() {
|
||||
toast.success("归还成功")
|
||||
},
|
||||
onError: (err) => {
|
||||
toast.error(err instanceof Error ? err.message : "归还失败")
|
||||
toast.error(getErrorMessage(err, "归还失败"))
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user