issue-40 #52
@ -43,12 +43,14 @@ export const AppBar = () => {
|
||||
useEffect(() => {
|
||||
if (metadataState) {
|
||||
if (metadataState.content) {
|
||||
const { picture, display_name, name } = JSON.parse(metadataState.content)
|
||||
|
||||
const { picture, display_name, name } = JSON.parse(
|
||||
metadataState.content
|
||||
)
|
||||
|
||||
if (picture) {
|
||||
setUserAvatar(picture)
|
||||
}
|
||||
|
||||
|
||||
setUsername(shorten(display_name || name || '', 7))
|
||||
} else {
|
||||
setUserAvatar('')
|
||||
@ -84,9 +86,7 @@ export const AppBar = () => {
|
||||
})
|
||||
)
|
||||
|
||||
dispatch(
|
||||
setMetadataEvent(metadataController.getEmptyMetadataEvent())
|
||||
)
|
||||
dispatch(setMetadataEvent(metadataController.getEmptyMetadataEvent()))
|
||||
|
||||
// clear authToken saved in local storage
|
||||
clearAuthToken()
|
||||
|
@ -54,6 +54,10 @@ type UserProps = {
|
||||
image?: string
|
||||
}
|
||||
|
||||
/**
|
||||
* This component will be used for the displaying username and profile picture.
|
||||
* If image is not available, robohash image will be displayed
|
||||
*/
|
||||
export const UserComponent = ({ pubkey, name, image }: UserProps) => {
|
||||
const theme = useTheme()
|
||||
|
||||
|
@ -5,7 +5,12 @@ import { useDispatch } from 'react-redux'
|
||||
import { Outlet } from 'react-router-dom'
|
||||
import { AppBar } from '../components/AppBar/AppBar'
|
||||
import { restoreState, setAuthState, setMetadataEvent } from '../store/actions'
|
||||
import { clearAuthToken, clearState, loadState, saveNsecBunkerDelegatedKey } from '../utils'
|
||||
import {
|
||||
clearAuthToken,
|
||||
clearState,
|
||||
loadState,
|
||||
saveNsecBunkerDelegatedKey
|
||||
} from '../utils'
|
||||
import { LoadingSpinner } from '../components/LoadingSpinner'
|
||||
import { Dispatch } from '../store/store'
|
||||
import { MetadataController, NostrController } from '../controllers'
|
||||
@ -29,9 +34,7 @@ export const MainLayout = () => {
|
||||
})
|
||||
)
|
||||
|
||||
dispatch(
|
||||
setMetadataEvent(metadataController.getEmptyMetadataEvent())
|
||||
)
|
||||
dispatch(setMetadataEvent(metadataController.getEmptyMetadataEvent()))
|
||||
|
||||
// clear authToken saved in local storage
|
||||
clearAuthToken()
|
||||
|
@ -53,9 +53,8 @@ export const Login = () => {
|
||||
dispatch(updateLoginMethod(LoginMethods.extension))
|
||||
|
||||
setLoadingSpinnerDesc('Authenticating and finding metadata')
|
||||
const redirectPath = await authController.authenticateAndFindMetadata(
|
||||
pubkey
|
||||
)
|
||||
const redirectPath =
|
||||
await authController.authenticateAndFindMetadata(pubkey)
|
||||
|
||||
navigate(redirectPath)
|
||||
})
|
||||
|
@ -89,6 +89,8 @@ export const SignPage = () => {
|
||||
} else {
|
||||
for (const signer of meta.signers) {
|
||||
if (!signedBy.includes(signer)) {
|
||||
// signers in meta.json are in npub1 format
|
||||
// so, convert it to hex before setting to nextSigner
|
||||
setNextSinger(npubToHex(signer)!)
|
||||
|
||||
const usersNpub = hexToNpub(usersPubkey!)
|
||||
|
Loading…
Reference in New Issue
Block a user