mirror of
https://github.com/fastapi/full-stack-fastapi-template.git
synced 2026-11-03 20:36:27 +00:00
Migrate route loaders and password flows to new client API
This commit is contained in:
@@ -11,7 +11,8 @@ import useAuth from "@/hooks/useAuth"
|
||||
|
||||
function getUsersQueryOptions() {
|
||||
return {
|
||||
queryFn: () => UsersService.readUsers({ skip: 0, limit: 100 }),
|
||||
queryFn: async () =>
|
||||
(await UsersService.readUsers({ query: { skip: 0, limit: 100 } })).data,
|
||||
queryKey: ["users"],
|
||||
}
|
||||
}
|
||||
@@ -19,7 +20,7 @@ function getUsersQueryOptions() {
|
||||
export const Route = createFileRoute("/_layout/admin")({
|
||||
component: Admin,
|
||||
beforeLoad: async () => {
|
||||
const user = await UsersService.readUserMe()
|
||||
const { data: user } = await UsersService.readUserMe()
|
||||
if (!user.is_superuser) {
|
||||
throw redirect({
|
||||
to: "/",
|
||||
|
||||
Reference in New Issue
Block a user