feat(route): Rewrite the API URL to original URL (#14617)
* feat(route): Rewrite the API URL to original URL * Update notifications.js * camelCase
This commit is contained in:
@@ -19,13 +19,19 @@ export default async (ctx) => {
|
||||
});
|
||||
const notifications = response.data;
|
||||
|
||||
const items = notifications.map((item) => ({
|
||||
title: item.subject.title,
|
||||
description: item.subject.title,
|
||||
pubDate: parseDate(item.updated_at), // item.updated_at follows ISO 8601.
|
||||
guid: item.id,
|
||||
link: item.subject.url,
|
||||
}));
|
||||
const items = notifications.map((item) => {
|
||||
let originUrl = item.subject.url ? item.subject.url.replace('https://api.github.com/repos/', 'https://github.com/') : 'https://github.com/notifications';
|
||||
if (originUrl.includes('/releases/')) {
|
||||
originUrl = originUrl.replace(/\/releases\/\d+$/, '/releases');
|
||||
}
|
||||
return {
|
||||
title: item.subject.title,
|
||||
description: item.subject.title,
|
||||
pubDate: parseDate(item.updated_at), // item.updated_at follows ISO 8601.
|
||||
guid: item.id,
|
||||
link: originUrl,
|
||||
};
|
||||
});
|
||||
|
||||
ctx.set('data', {
|
||||
title: 'Github Notifications',
|
||||
|
||||
Reference in New Issue
Block a user