mirror of
https://github.com/Qortal/qortal-mobile.git
synced 2025-06-14 20:11:22 +00:00
fix blocked info at startup
This commit is contained in:
parent
2fbc48d676
commit
15c1373cb0
@ -442,7 +442,7 @@ function App() {
|
|||||||
const { isShow, onCancel, onOk, show, message } = useModal();
|
const { isShow, onCancel, onOk, show, message } = useModal();
|
||||||
const {isUserBlocked,
|
const {isUserBlocked,
|
||||||
addToBlockList,
|
addToBlockList,
|
||||||
removeBlockFromList, getAllBlockedUsers} = useBlockedAddresses()
|
removeBlockFromList, getAllBlockedUsers} = useBlockedAddresses(extState === 'authenticated')
|
||||||
const {
|
const {
|
||||||
isShow: isShowUnsavedChanges,
|
isShow: isShowUnsavedChanges,
|
||||||
onCancel: onCancelUnsavedChanges,
|
onCancel: onCancelUnsavedChanges,
|
||||||
|
@ -3,7 +3,7 @@ import React, { useCallback, useEffect, useRef } from "react";
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
export const useBlockedAddresses = () => {
|
export const useBlockedAddresses = (isAuthenticated: boolean) => {
|
||||||
const userBlockedRef = useRef({})
|
const userBlockedRef = useRef({})
|
||||||
const userNamesBlockedRef = useRef({})
|
const userNamesBlockedRef = useRef({})
|
||||||
|
|
||||||
@ -28,6 +28,9 @@ export const useBlockedAddresses = () => {
|
|||||||
}, [])
|
}, [])
|
||||||
|
|
||||||
useEffect(()=> {
|
useEffect(()=> {
|
||||||
|
if (!isAuthenticated) return;
|
||||||
|
userBlockedRef.current = {};
|
||||||
|
userNamesBlockedRef.current = {};
|
||||||
const fetchBlockedList = async ()=> {
|
const fetchBlockedList = async ()=> {
|
||||||
try {
|
try {
|
||||||
const response = await new Promise((res, rej) => {
|
const response = await new Promise((res, rej) => {
|
||||||
@ -86,7 +89,7 @@ export const useBlockedAddresses = () => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
fetchBlockedList()
|
fetchBlockedList()
|
||||||
}, [])
|
}, [isAuthenticated])
|
||||||
|
|
||||||
const removeBlockFromList = useCallback(async (address, name)=> {
|
const removeBlockFromList = useCallback(async (address, name)=> {
|
||||||
if(name){
|
if(name){
|
||||||
|
Loading…
x
Reference in New Issue
Block a user