Basic code quality stuff
This commit is contained in:
parent
53050c48fb
commit
d1c0269a81
18 changed files with 84 additions and 85 deletions
|
@ -2,9 +2,9 @@ import { Handler } from '@netlify/functions'
|
|||
import { Octokit } from '@octokit/core'
|
||||
import { GithubInfo } from '../../src/components/infos/Git'
|
||||
|
||||
const handler: Handler = async (event, context) => {
|
||||
let octokit = new Octokit({auth: process.env.API_GITHUB})
|
||||
let github = await octokit.request("GET /users/TTTaevas/events", {per_page: 100})
|
||||
const handler: Handler = async () => {
|
||||
const octokit = new Octokit({auth: process.env.API_GITHUB})
|
||||
const github = await octokit.request("GET /users/TTTaevas/events", {per_page: 100})
|
||||
if (github.status !== 200) {
|
||||
return {
|
||||
statusCode: 404,
|
||||
|
@ -12,8 +12,8 @@ const handler: Handler = async (event, context) => {
|
|||
}
|
||||
}
|
||||
|
||||
let public_push = github.data.find((e: {type: string, public: boolean}) => e.type === "PushEvent" && e.public === true)
|
||||
let private_push = github.data.find((e: {type: string, public: boolean}) => e.type === "PushEvent" && e.public === false)
|
||||
const public_push = github.data.find((e: {type: string, public: boolean}) => e.type === "PushEvent" && e.public === true)
|
||||
const private_push = github.data.find((e: {type: string, public: boolean}) => e.type === "PushEvent" && e.public === false)
|
||||
if (!public_push || !private_push) {
|
||||
return {
|
||||
statusCode: 404,
|
||||
|
@ -21,7 +21,7 @@ const handler: Handler = async (event, context) => {
|
|||
}
|
||||
}
|
||||
|
||||
let info: GithubInfo = {
|
||||
const info: GithubInfo = {
|
||||
public: {
|
||||
repo: public_push.repo.name,
|
||||
date: public_push.created_at.substring(0, public_push.created_at.indexOf("T"))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue