From 2cd2f92e9e0c82eaa5f21fe0c30e20ebea7aba24 Mon Sep 17 00:00:00 2001
From: MohamedBassem <me@mbassem.com>
Date: Fri, 22 Mar 2024 15:10:24 +0000
Subject: fix(mobile): Fix setting propagatin

---
 apps/mobile/app/dashboard/(tabs)/settings.tsx | 22 +++++-----------------
 1 file changed, 5 insertions(+), 17 deletions(-)

(limited to 'apps/mobile/app/dashboard/(tabs)/settings.tsx')

diff --git a/apps/mobile/app/dashboard/(tabs)/settings.tsx b/apps/mobile/app/dashboard/(tabs)/settings.tsx
index fe138f52..f60c2495 100644
--- a/apps/mobile/app/dashboard/(tabs)/settings.tsx
+++ b/apps/mobile/app/dashboard/(tabs)/settings.tsx
@@ -1,29 +1,17 @@
-import { useEffect } from "react";
 import { SafeAreaView, Text, View } from "react-native";
-import { useRouter } from "expo-router";
 import { Button } from "@/components/ui/Button";
+import PageTitle from "@/components/ui/PageTitle";
 import { useSession } from "@/lib/session";
 import { api } from "@/lib/trpc";
-import PageTitle from "@/components/ui/PageTitle";
 
 export default function Dashboard() {
-  const router = useRouter();
-
-  const { isLoggedIn, logout } = useSession();
-
-  useEffect(() => {
-    if (isLoggedIn !== undefined && !isLoggedIn) {
-      router.replace("signin");
-    }
-  }, [isLoggedIn]);
+  const { logout } = useSession();
 
   const { data, error, isLoading } = api.users.whoami.useQuery();
 
-  useEffect(() => {
-    if (error?.data?.code === "UNAUTHORIZED") {
-      logout();
-    }
-  }, [error]);
+  if (error?.data?.code === "UNAUTHORIZED") {
+    logout();
+  }
 
   return (
     <SafeAreaView>
-- 
cgit v1.2.3-70-g09d2

