aboutsummaryrefslogtreecommitdiffstats
path: root/apps/web/components/utils
diff options
context:
space:
mode:
authorMohamed Bassem <me@mbassem.com>2026-02-01 12:29:54 +0000
committerGitHub <noreply@github.com>2026-02-01 12:29:54 +0000
commit65f6e83f11c82b0ec762e11f3392a80e614ee69a (patch)
tree945d8d73122f07fe6a77c2bd3ac9db566939ba3b /apps/web/components/utils
parente516a525bca6f319a2f003e9677624e968b277bf (diff)
downloadkarakeep-65f6e83f11c82b0ec762e11f3392a80e614ee69a.tar.zst
refactor: migrate trpc to the new react query integration mode (#2438)
* refactor: migrate trpc to the new react query integration mode * more fixes * more migrations * upgrade trpc client
Diffstat (limited to 'apps/web/components/utils')
-rw-r--r--apps/web/components/utils/ValidAccountCheck.tsx22
1 files changed, 13 insertions, 9 deletions
diff --git a/apps/web/components/utils/ValidAccountCheck.tsx b/apps/web/components/utils/ValidAccountCheck.tsx
index 5ca5fd5c..49f42f9c 100644
--- a/apps/web/components/utils/ValidAccountCheck.tsx
+++ b/apps/web/components/utils/ValidAccountCheck.tsx
@@ -2,22 +2,26 @@
import { useEffect } from "react";
import { useRouter } from "next/navigation";
-import { api } from "@/lib/trpc";
+import { useTRPC } from "@/lib/trpc";
+import { useQuery } from "@tanstack/react-query";
/**
* This component is used to address a confusion when the JWT token exists but the user no longer exists in the database.
* So this component synchronusly checks if the user is still valid and if not, signs out the user.
*/
export default function ValidAccountCheck() {
+ const api = useTRPC();
const router = useRouter();
- const { error } = api.users.whoami.useQuery(undefined, {
- retry: (_failureCount, error) => {
- if (error.data?.code === "UNAUTHORIZED") {
- return false;
- }
- return true;
- },
- });
+ const { error } = useQuery(
+ api.users.whoami.queryOptions(undefined, {
+ retry: (_failureCount, error) => {
+ if (error.data?.code === "UNAUTHORIZED") {
+ return false;
+ }
+ return true;
+ },
+ }),
+ );
useEffect(() => {
if (error?.data?.code === "UNAUTHORIZED") {
router.push("/logout");