-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'abdulhaseeb/eng-2551-updated-functions-for-ordinal-tran…
…sactions' of https://github.com/secretkeylabs/xverse-web-extension into abdulhaseeb/eng-2551-updated-functions-for-ordinal-transactions
- Loading branch information
Showing
16 changed files
with
420 additions
and
168 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,22 @@ | ||
import useHasStateRehydrated from '@hooks/stores/useHasRehydrated'; | ||
import useWalletSelector from '@hooks/useWalletSelector'; | ||
import { ReactNode } from 'react'; | ||
import { Navigate } from 'react-router-dom'; | ||
|
||
interface AuthGuardProps { | ||
children: ReactNode; | ||
} | ||
|
||
function AuthGuard({ children }: AuthGuardProps) { | ||
function AuthGuard({ children }: React.PropsWithChildren) { | ||
const { encryptedSeed, seedPhrase } = useWalletSelector(); | ||
const hydrated = useHasStateRehydrated(); | ||
if (hydrated && encryptedSeed && !seedPhrase) return <Navigate to="/login" />; | ||
|
||
if (hydrated && !encryptedSeed) return <Navigate to="/landing" />; | ||
if (hydrated && encryptedSeed && !seedPhrase) { | ||
return <Navigate to="/login" />; | ||
} | ||
|
||
if (hydrated && !encryptedSeed) { | ||
return <Navigate to="/landing" />; | ||
} | ||
|
||
return children; | ||
// fragment is required here | ||
// eslint-disable-next-line react/jsx-no-useless-fragment | ||
return <>{children}</>; | ||
} | ||
|
||
export default AuthGuard; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.