fix(tiki): fetch roleNFTs from blockchain instead of returning empty array

- getAllTikiNFTDetails now calls fetchUserTikiNFTs to query UserTikis storage
- This enables proper authorization check for government roles like Serok
This commit is contained in:
2026-02-10 22:56:22 +03:00
parent cd69be7487
commit fc0907f8ac
+9 -4
View File
@@ -549,14 +549,19 @@ export const getAllTikiNFTDetails = async (
totalNFTs: number; totalNFTs: number;
}> => { }> => {
try { try {
// Only fetch citizen NFT because it's the only one with stored item ID // Fetch citizen NFT details (has stored item ID in CitizenNft storage)
// Role assignments in UserTikis don't have associated NFT item IDs
const citizenNFT = await getCitizenNFTDetails(api, address); const citizenNFT = await getCitizenNFTDetails(api, address);
// Fetch all role tikis from UserTikis storage on blockchain
const allRoleNFTs = await fetchUserTikiNFTs(api, address);
// Filter out Welati since it's represented by citizenNFT
const roleNFTs = allRoleNFTs.filter(nft => nft.tikiRole !== 'Welati');
return { return {
citizenNFT, citizenNFT,
roleNFTs: [], // Don't show role NFTs because UserTikis doesn't store item IDs roleNFTs,
totalNFTs: citizenNFT ? 1 : 0 totalNFTs: (citizenNFT ? 1 : 0) + roleNFTs.length
}; };
} catch (error) { } catch (error) {