mirror of
https://github.com/DIYgod/RSSHub.git
synced 2025-12-05 20:27:52 +08:00
29 lines
829 B
JavaScript
29 lines
829 B
JavaScript
const axios = require('@/utils/axios');
|
|
const config = require('@/config');
|
|
|
|
module.exports = async (ctx) => {
|
|
const user = ctx.params.user;
|
|
|
|
const response = await axios({
|
|
method: 'get',
|
|
url: `https://api.github.com/users/${user}/repos`,
|
|
params: {
|
|
sort: 'created',
|
|
access_token: config.github.access_token,
|
|
},
|
|
});
|
|
const data = response.data;
|
|
ctx.state.data = {
|
|
title: `${user}'s GitHub repositories`,
|
|
link: `https://github.com/${user}`,
|
|
item:
|
|
data &&
|
|
data.map((item) => ({
|
|
title: item.name,
|
|
description: item.description || 'No description',
|
|
pubDate: new Date(item.created_at).toUTCString(),
|
|
link: item.html_url,
|
|
})),
|
|
};
|
|
};
|