distinguish malformed document lists
This commit is contained in:
@@ -14,7 +14,10 @@ function Overview({tenders,now}) {
|
||||
useEffect(()=>{
|
||||
let cancelled=false;
|
||||
setVault({loading:true,error:null,documents:[]});
|
||||
listDocuments().then(data=>{if(!cancelled)setVault({loading:false,error:null,documents:Array.isArray(data?.belgeler) ? data.belgeler : []});})
|
||||
listDocuments().then(data=>{
|
||||
if (!Array.isArray(data?.belgeler)) throw new Error('Belge listesi biçimi doğrulanamadı.');
|
||||
if(!cancelled)setVault({loading:false,error:null,documents:data.belgeler});
|
||||
})
|
||||
.catch(error=>{if(!cancelled)setVault({loading:false,error:error.message,documents:[]});});
|
||||
return()=>{cancelled=true;};
|
||||
},[refresh]);
|
||||
|
||||
Reference in New Issue
Block a user