mirror of
https://github.com/Qortal/chrome-extension.git
synced 2025-06-14 20:31:21 +00:00
fix blocked info at startup
This commit is contained in:
parent
bd41d0fddc
commit
624a43555f
@ -328,7 +328,7 @@ function App() {
|
||||
useState<string>("");
|
||||
const {isUserBlocked,
|
||||
addToBlockList,
|
||||
removeBlockFromList, getAllBlockedUsers} = useBlockedAddresses()
|
||||
removeBlockFromList, getAllBlockedUsers} = useBlockedAddresses(extState === 'authenticated')
|
||||
const [isOpenDrawerLookup, setIsOpenDrawerLookup] = useState(false)
|
||||
const [isMain, setIsMain] = useState<boolean>(
|
||||
window?.location?.href?.includes("?main=true")
|
||||
|
@ -3,7 +3,7 @@ import React, { useCallback, useEffect, useRef } from "react";
|
||||
|
||||
|
||||
|
||||
export const useBlockedAddresses = () => {
|
||||
export const useBlockedAddresses = (isAuthenticated: boolean) => {
|
||||
const userBlockedRef = useRef({})
|
||||
const userNamesBlockedRef = useRef({})
|
||||
|
||||
@ -28,6 +28,9 @@ export const useBlockedAddresses = () => {
|
||||
}, [])
|
||||
|
||||
useEffect(()=> {
|
||||
if (!isAuthenticated) return;
|
||||
userBlockedRef.current = {};
|
||||
userNamesBlockedRef.current = {};
|
||||
const fetchBlockedList = async ()=> {
|
||||
try {
|
||||
const response = await new Promise((res, rej) => {
|
||||
@ -86,7 +89,7 @@ export const useBlockedAddresses = () => {
|
||||
}
|
||||
}
|
||||
fetchBlockedList()
|
||||
}, [])
|
||||
}, [isAuthenticated])
|
||||
const removeBlockFromList = useCallback(async (address, name)=> {
|
||||
if(name){
|
||||
await new Promise((res, rej) => {
|
||||
|
Loading…
x
Reference in New Issue
Block a user