return posts.map((post) => {
- return `=> ${post.url} ${post.title}\n${post.notes}`;
+ const title = post.title || post.website_title
+ return `=> ${post.url} ${title}\n${post.notes}`;
}).join('\n\n');
},
getTitle(posts) {
+ const title = posts[0].title || posts[0].website_title
+
if (posts.length === 1) {
- return `Link: ${posts[0].title}`;
+ return `Link: ${title}`;
}
return `${posts.length} links for ${internals.date}`;
},
async updateBookmark(bookmark) {
- console.log(bookmark.tag_names);
- console.log(bookmark.tag_names.map((tag) => tag === 'linkblog' ? 'linkblog-posted' : tag));
-
const url = join(internals.apiUrl, 'bookmarks', `${bookmark.id}`)
const response = await fetch(url, {
method: 'PATCH',
Authorization: `Token ${internals.apiToken}`
}
});
-
- const data = await response.text();
- console.log(url);
- console.log(data);
}
};