Spaces:
Configuration error
Configuration error
Download frontend/src/hooks/query/use-is-authed.ts from flyingdarkdev/README: direct link, hf CLI and curl.
- Browser
- Download file 720 Bytes
-
https://huggingface.co/spaces/flyingdarkdev/README/resolve/main/frontend/src/hooks/query/use-is-authed.ts
- Command line
-
hf download hf://spaces/flyingdarkdev/README/frontend/src/hooks/query/use-is-authed.ts
-
curl -L -o use-is-authed.ts https://huggingface.co/spaces/flyingdarkdev/README/resolve/main/frontend/src/hooks/query/use-is-authed.ts
720 Bytes
| import { useQuery } from "@tanstack/react-query"; | |
| import React from "react"; | |
| import OpenHands from "#/api/open-hands"; | |
| import { useConfig } from "./use-config"; | |
| import { useAuth } from "#/context/auth-context"; | |
| export const useIsAuthed = () => { | |
| const { githubTokenIsSet } = useAuth(); | |
| const { data: config } = useConfig(); | |
| const appMode = React.useMemo(() => config?.APP_MODE, [config]); | |
| return useQuery({ | |
| queryKey: ["user", "authenticated", githubTokenIsSet, appMode], | |
| queryFn: () => OpenHands.authenticate(appMode!), | |
| enabled: !!appMode, | |
| staleTime: 1000 * 60 * 5, // 5 minutes | |
| gcTime: 1000 * 60 * 15, // 15 minutes | |
| retry: false, | |
| meta: { | |
| disableToast: true, | |
| }, | |
| }); | |
| }; | |