aboutsummaryrefslogtreecommitdiffstats
path: root/apps/web/components/signin
diff options
context:
space:
mode:
Diffstat (limited to 'apps/web/components/signin')
-rw-r--r--apps/web/components/signin/CredentialsForm.tsx2
-rw-r--r--apps/web/components/signin/ForgotPasswordForm.tsx9
-rw-r--r--apps/web/components/signin/ResetPasswordForm.tsx8
-rw-r--r--apps/web/components/signin/SignInProviderButton.tsx2
4 files changed, 15 insertions, 6 deletions
diff --git a/apps/web/components/signin/CredentialsForm.tsx b/apps/web/components/signin/CredentialsForm.tsx
index 4a4a0533..0ff5b1d0 100644
--- a/apps/web/components/signin/CredentialsForm.tsx
+++ b/apps/web/components/signin/CredentialsForm.tsx
@@ -14,10 +14,10 @@ import {
FormMessage,
} from "@/components/ui/form";
import { Input } from "@/components/ui/input";
+import { signIn } from "@/lib/auth/client";
import { useClientConfig } from "@/lib/clientConfig";
import { zodResolver } from "@hookform/resolvers/zod";
import { AlertCircle, Lock } from "lucide-react";
-import { signIn } from "next-auth/react";
import { useForm } from "react-hook-form";
import { z } from "zod";
diff --git a/apps/web/components/signin/ForgotPasswordForm.tsx b/apps/web/components/signin/ForgotPasswordForm.tsx
index 29d55f2b..7ba37553 100644
--- a/apps/web/components/signin/ForgotPasswordForm.tsx
+++ b/apps/web/components/signin/ForgotPasswordForm.tsx
@@ -20,18 +20,21 @@ import {
FormMessage,
} from "@/components/ui/form";
import { Input } from "@/components/ui/input";
-import { api } from "@/lib/trpc";
import { zodResolver } from "@hookform/resolvers/zod";
+import { useMutation } from "@tanstack/react-query";
import { TRPCClientError } from "@trpc/client";
import { AlertCircle, CheckCircle } from "lucide-react";
import { useForm } from "react-hook-form";
import { z } from "zod";
+import { useTRPC } from "@karakeep/shared-react/trpc";
+
const forgotPasswordSchema = z.object({
email: z.string().email("Please enter a valid email address"),
});
export default function ForgotPasswordForm() {
+ const api = useTRPC();
const [isSubmitted, setIsSubmitted] = useState(false);
const [errorMessage, setErrorMessage] = useState("");
const router = useRouter();
@@ -40,7 +43,9 @@ export default function ForgotPasswordForm() {
resolver: zodResolver(forgotPasswordSchema),
});
- const forgotPasswordMutation = api.users.forgotPassword.useMutation();
+ const forgotPasswordMutation = useMutation(
+ api.users.forgotPassword.mutationOptions(),
+ );
const onSubmit = async (values: z.infer<typeof forgotPasswordSchema>) => {
try {
diff --git a/apps/web/components/signin/ResetPasswordForm.tsx b/apps/web/components/signin/ResetPasswordForm.tsx
index d4d8a285..571a09ae 100644
--- a/apps/web/components/signin/ResetPasswordForm.tsx
+++ b/apps/web/components/signin/ResetPasswordForm.tsx
@@ -20,13 +20,14 @@ import {
FormMessage,
} from "@/components/ui/form";
import { Input } from "@/components/ui/input";
-import { api } from "@/lib/trpc";
import { zodResolver } from "@hookform/resolvers/zod";
+import { useMutation } from "@tanstack/react-query";
import { TRPCClientError } from "@trpc/client";
import { AlertCircle, CheckCircle } from "lucide-react";
import { useForm } from "react-hook-form";
import { z } from "zod";
+import { useTRPC } from "@karakeep/shared-react/trpc";
import { zResetPasswordSchema } from "@karakeep/shared/types/users";
const resetPasswordSchema = z
@@ -44,6 +45,7 @@ interface ResetPasswordFormProps {
}
export default function ResetPasswordForm({ token }: ResetPasswordFormProps) {
+ const api = useTRPC();
const [isSuccess, setIsSuccess] = useState(false);
const [errorMessage, setErrorMessage] = useState("");
const router = useRouter();
@@ -52,7 +54,9 @@ export default function ResetPasswordForm({ token }: ResetPasswordFormProps) {
resolver: zodResolver(resetPasswordSchema),
});
- const resetPasswordMutation = api.users.resetPassword.useMutation();
+ const resetPasswordMutation = useMutation(
+ api.users.resetPassword.mutationOptions(),
+ );
const onSubmit = async (values: z.infer<typeof resetPasswordSchema>) => {
try {
diff --git a/apps/web/components/signin/SignInProviderButton.tsx b/apps/web/components/signin/SignInProviderButton.tsx
index edb411e6..4b218e2a 100644
--- a/apps/web/components/signin/SignInProviderButton.tsx
+++ b/apps/web/components/signin/SignInProviderButton.tsx
@@ -1,7 +1,7 @@
"use client";
import { Button } from "@/components/ui/button";
-import { signIn } from "next-auth/react";
+import { signIn } from "@/lib/auth/client";
export default function SignInProviderButton({
provider,