Fork of atp.tools as a universal profile for people on the ATmosphere

type constellation responses correctly

Natalie B. a11b318c 49f28655

Changed files
+18 -6
src
+2 -2
src/components/allBacklinksViewer.tsx
··· 152 152 <p className="text-muted-foreground w-max"> 153 153 Nothing doing! No links indexed for this target! 154 154 </p> 155 - <span> 155 + <span className="text-muted-foreground"> 156 156 You can{" "} 157 157 <a 158 158 href={`https://constellation.microcosm.blue/links/all?target=${encodeURIComponent(aturi)}`} 159 159 className="text-blue-500 hover:underline" 160 160 > 161 - check for updates here 161 + view the api response. 162 162 </a> 163 163 . 164 164 </span>
+8 -2
src/routes/constellation/dids.$collection.tsx
··· 27 27 isLoading: boolean; 28 28 } 29 29 30 + interface DistinctDidsResponse { 31 + total: number; 32 + linking_dids: string[]; 33 + cursor: string; 34 + } 35 + 30 36 function useConstellationLink( 31 37 collection: string, 32 38 target: string, ··· 61 67 `https://constellation.microcosm.blue/links/distinct-dids?target=${target}&collection=${collection}&path=${path}${cursor ? `&cursor=${cursor}` : ""}`, 62 68 ); 63 69 64 - let data = await response.json(); 70 + let data: DistinctDidsResponse = await response.json(); 65 71 setLink((prev) => ({ 66 72 ...prev, 67 73 totalLinks: data.total, 68 74 links: [...(prev.links || []), ...data.linking_dids], 69 75 cursor: data.cursor, 70 - error: data.error, 76 + error: cursor === null ? Error("Nothing found") : null, 71 77 isLoading: false, 72 78 })); 73 79 };
+8 -2
src/routes/constellation/links.$collection.tsx
··· 18 18 }, 19 19 }); 20 20 21 + interface DistinctDidsResponse { 22 + total: number; 23 + linking_records: CLink[]; 24 + cursor: string; 25 + } 26 + 21 27 interface CLink { 22 28 did: string; 23 29 collection: string; ··· 66 72 `https://constellation.microcosm.blue/links?target=${target}&collection=${collection}&path=${path}${cursor ? `&cursor=${cursor}` : ""}`, 67 73 ); 68 74 69 - let data = await response.json(); 75 + let data: DistinctDidsResponse = await response.json(); 70 76 setLink((prev) => ({ 71 77 ...prev, 72 78 totalLinks: data.total, 73 79 links: [...(prev.links || []), ...data.linking_records], 74 80 cursor: data.cursor, 75 - error: data.error, 81 + error: data.linking_records.length === 0 ? Error("Nothing found") : null, 76 82 isLoading: false, 77 83 })); 78 84 };