File tree Expand file tree Collapse file tree 1 file changed +4
-2
lines changed
Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Original file line number Diff line number Diff line change 4343 }
4444
4545 if (uri ) {
46- const res = await fetch (` ${API_URL }/api/annotation?uri=${encodeURIComponent (uri )} ` );
46+ const isCollection = uri .includes (' /at.margin.collection/' );
47+ const endpoint = isCollection ? ' collection' : ' annotation' ;
48+ const res = await fetch (` ${API_URL }/api/${endpoint }?uri=${encodeURIComponent (uri )} ` );
4749 if (res .ok ) {
4850 const item = await res .json ();
4951 const author = item .author || item .creator || {};
6365 ? ` ${targetTitle } — bookmarked by @${handle } `
6466 : ` Bookmark by @${handle } ` ;
6567 description = bodyText ?.slice (0 , 200 ) || ' A bookmark on Margin' ;
66- } else if (uri . includes ( ' /at.margin.collection/ ' ) ) {
68+ } else if (isCollection ) {
6769 title = ` ${item .name || ' Collection' } by @${handle } ` ;
6870 description = item .description ?.slice (0 , 200 ) || ' A collection on Margin' ;
6971 } else {
You can’t perform that action at this time.
0 commit comments