Spaces:
Configuration error
Configuration error
Download frontend/src/hooks/use-github-auth-url.ts from flyingdarkdev/README: direct link, hf CLI and curl.
- Browser
- Download file 770 Bytes
-
https://huggingface.co/spaces/flyingdarkdev/README/resolve/main/frontend/src/hooks/use-github-auth-url.ts
- Command line
-
hf download hf://spaces/flyingdarkdev/README/frontend/src/hooks/use-github-auth-url.ts
-
curl -L -o use-github-auth-url.ts https://huggingface.co/spaces/flyingdarkdev/README/resolve/main/frontend/src/hooks/use-github-auth-url.ts
770 Bytes
| import React from "react"; | |
| import { generateGitHubAuthUrl } from "#/utils/generate-github-auth-url"; | |
| import { GetConfigResponse } from "#/api/open-hands.types"; | |
| import { useAuth } from "#/context/auth-context"; | |
| interface UseGitHubAuthUrlConfig { | |
| appMode: GetConfigResponse["APP_MODE"] | null; | |
| gitHubClientId: GetConfigResponse["GITHUB_CLIENT_ID"] | null; | |
| } | |
| export const useGitHubAuthUrl = (config: UseGitHubAuthUrlConfig) => { | |
| const { githubTokenIsSet } = useAuth(); | |
| return React.useMemo(() => { | |
| if (config.appMode === "saas" && !githubTokenIsSet) | |
| return generateGitHubAuthUrl( | |
| config.gitHubClientId || "", | |
| new URL(window.location.href), | |
| ); | |
| return null; | |
| }, [githubTokenIsSet, config.appMode, config.gitHubClientId]); | |
| }; | |