resolving promise reject when async storage is null (#45)
Co-authored-by: Gustavo Emanuel Farias Rosa <gustavoemanuelfariasrosa@Mac-mini-de-Gustavo.local>
This commit is contained in:
parent
f01348c28a
commit
c52d081e1f
@ -51,8 +51,22 @@ const DeepLink = ()=>{
|
||||
}
|
||||
|
||||
async function checkIfHaveTemporaryPortal(){
|
||||
const portalsFromStorage = await AsyncStorage.getItem('portal')
|
||||
const portalsParsed = JSON.parse(portalsFromStorage)
|
||||
let portalsParsed: IPortal[]|null = null;
|
||||
try {
|
||||
let items = await AsyncStorage.getAllKeys();
|
||||
if (items.includes('portal')) {
|
||||
const portalsFromStorage = await AsyncStorage.getItem('portal')
|
||||
portalsParsed = portalsFromStorage ? JSON.parse(portalsFromStorage) : null
|
||||
} else {
|
||||
console.log('Error: Dont Have Portals Storage');
|
||||
}
|
||||
} catch (e) {
|
||||
console.log('error', e);
|
||||
}
|
||||
|
||||
if(!portalsParsed){
|
||||
return
|
||||
}
|
||||
const portalsWithoutTemporary = portalsParsed.filter((portal: IPortal)=>{
|
||||
if(portal.temporary == true) return false
|
||||
if(portal.name == NAME_PORTALS_DEEP_LINK) return false
|
||||
|
Loading…
Reference in New Issue
Block a user