import { useState } from "react"; import { Helmet } from "react-helmet"; import { faArrowUpRightFromSquare, faBookOpen } from "@fortawesome/free-solid-svg-icons"; import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; import { useNavigate } from "@tanstack/react-router"; import { Button, Card, CardTitle, FormControl, Input } from "@app/components/v2"; import { useWorkspace } from "@app/context"; import { useSaveIntegrationAccessToken } from "@app/hooks/api"; export const AzureDevopsAuthorizePage = () => { const navigate = useNavigate(); const { mutateAsync } = useSaveIntegrationAccessToken(); const [apiKey, setApiKey] = useState(""); const [devopsOrgName, setDevopsOrgName] = useState(""); const [apiKeyErrorText, setApiKeyErrorText] = useState(""); const [isLoading, setIsLoading] = useState(false); const { currentWorkspace } = useWorkspace(); const handleButtonClick = async () => { try { setApiKeyErrorText(""); if (apiKey.length === 0) { setApiKeyErrorText("API Key cannot be blank"); return; } setIsLoading(true); localStorage.setItem("azure-devops-org-name", devopsOrgName); const integrationAuth = await mutateAsync({ workspaceId: currentWorkspace.id, integration: "azure-devops", accessToken: btoa(`:${apiKey}`) // This is a base64 encoding of the API key without any username }); setIsLoading(false); navigate({ to: "/secret-manager/$projectId/integrations/azure-devops/create", params: { projectId: currentWorkspace.id }, search: { integrationAuthId: integrationAuth.id } }); } catch (err) { console.error(err); } }; return (