diff --git a/src/components/AppContainer/index.tsx b/src/components/AppContainer/index.tsx
index 572ced7ae..d8c5c347e 100644
--- a/src/components/AppContainer/index.tsx
+++ b/src/components/AppContainer/index.tsx
@@ -1,20 +1,18 @@
import { lazy, Suspense } from 'react'
import { Route, Routes } from 'react-router-dom'
-import { useDataStore } from '~/stores/useDataStore'
import { E2ETests } from '~/utils'
import { AppProviders } from '../App/Providers'
-import { Splash } from '../App/Splash'
import { AuthGuard } from '../Auth'
const LazyApp = lazy(() => import('../App').then(({ App }) => ({ default: App })))
export const AppContainer = () => {
const App =
- const { splashDataLoading } = useDataStore((s) => s)
+ // const { splashDataLoading } = useDataStore((s) => s)
return (
- {splashDataLoading && }
+ {/* {splashDataLoading && } */}
Loading...}>
diff --git a/src/components/Auth/index.tsx b/src/components/Auth/index.tsx
index b451be49a..43aa7c763 100644
--- a/src/components/Auth/index.tsx
+++ b/src/components/Auth/index.tsx
@@ -5,15 +5,19 @@ import { Flex } from '~/components/common/Flex'
import { Text } from '~/components/common/Text'
import { isDevelopment, isE2E } from '~/constants'
import { getIsAdmin } from '~/network/auth'
+import { useDataStore } from '~/stores/useDataStore'
import { useFeatureFlagStore } from '~/stores/useFeatureFlagStore'
import { useUserStore } from '~/stores/useUserStore'
import { sphinxBridge } from '~/testSphinxBridge'
import { updateBudget } from '~/utils'
import { isAndroid, isWebView } from '~/utils/isWebView'
+import { Splash } from '../App/Splash'
export const AuthGuard = ({ children }: PropsWithChildren) => {
- const [unAuthorized, setUnauthorized] = useState(false)
+ const [unAuthorized, setUnauthorized] = useState(true)
const { setBudget, setIsAdmin, setPubKey, setIsAuthenticated } = useUserStore((s) => s)
+ const { splashDataLoading } = useDataStore((s) => s)
+ const [showSplashScreen, setShowSplashScreen] = useState(true)
const [
setTrendingTopicsFeatureFlag,
@@ -62,11 +66,7 @@ export const AuthGuard = ({ children }: PropsWithChildren) => {
try {
const res = await getIsAdmin()
- if (!res.data.isPublic && !res.data.isAdmin && !res.data.isMember) {
- setUnauthorized(true)
-
- return
- }
+ setUnauthorized(false)
if (res.data) {
localStorage.setItem('admin', JSON.stringify({ isAdmin: res.data.isAdmin }))
@@ -82,6 +82,8 @@ export const AuthGuard = ({ children }: PropsWithChildren) => {
setIsAuthenticated(true)
} catch (error) {
/* not an admin */
+ } finally {
+ setShowSplashScreen(false)
}
}, [
setIsAuthenticated,
@@ -117,6 +119,10 @@ export const AuthGuard = ({ children }: PropsWithChildren) => {
const message = 'This is a private Graph, Contact Admin'
+ if (showSplashScreen) {
+ return <>{splashDataLoading && }>
+ }
+
if (unAuthorized) {
return (
@@ -125,7 +131,12 @@ export const AuthGuard = ({ children }: PropsWithChildren) => {
)
}
- return <>{children}>
+ return (
+ <>
+ {splashDataLoading && }
+ {children}
+ >
+ )
}
const StyledText = styled(Text)`
diff --git a/src/utils/getSignedMessage/index.ts b/src/utils/getSignedMessage/index.ts
index 18b9a2fbe..fa366bb00 100644
--- a/src/utils/getSignedMessage/index.ts
+++ b/src/utils/getSignedMessage/index.ts
@@ -35,7 +35,11 @@ export async function getSignedMessageFromRelay(): Promise<{ message: string; si
.then((storedLsat: any) => {
signingPromise = null // Reset the promise after it's resolved
- const response = { message, signature: storedLsat.signature }
+ if (!storedLsat) {
+ return { message: '', signature: '' }
+ }
+
+ const response = { message, signature: storedLsat?.signature || '' }
storeSignatureInLocalStorage({ ...response })