import { useRouter } from "next/router"; import { useState } from "react"; import { useForm } from "react-hook-form"; import { Toaster } from "react-hot-toast"; import { useLocale } from "@calcom/lib/hooks/useLocale"; import { Alert, Button, Form, TextField } from "@calcom/ui/v2"; export default function Exchange2013CalendarSetup() { const { t } = useLocale(); const router = useRouter(); const form = useForm({ defaultValues: { username: "", password: "", url: process.env.EXCHANGE_DEFAULT_EWS_URL || "", }, }); const [errorMessage, setErrorMessage] = useState(""); return (
Exchange 2013 Calendar

{t("add_exchange2013")}

{t("credentials_stored_encrypted")}
{ setErrorMessage(""); const res = await fetch("/api/integrations/exchange2013calendar/add", { method: "POST", body: JSON.stringify(values), headers: { "Content-Type": "application/json", }, }); const json = await res.json(); if (!res.ok) { setErrorMessage(json?.message || t("something_went_wrong")); } else { router.push(json.url); } }}>
{errorMessage && }
); }