mirror of
https://github.com/System-End/site.git
synced 2026-04-19 23:22:49 +00:00
Merge pull request #721 from grymmy/fix-site-locally
Fixes local development environment
This commit is contained in:
commit
38837bedb5
3 changed files with 12 additions and 5 deletions
|
|
@ -1,3 +1,3 @@
|
|||
export default function Comma({ children }) {
|
||||
return children.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ',')
|
||||
return children ? children.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ',') : ''
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ import FormData from 'form-data'
|
|||
export async function Slack() {
|
||||
const formData = new FormData()
|
||||
|
||||
formData.append('token', process.env.SLACK_API_TOKEN)
|
||||
formData.append('token', process.env.SLACK_API_TOKEN || 'invalid_no_slack_token')
|
||||
formData.append('date_range', '30d')
|
||||
|
||||
let slackData = await fetch(
|
||||
|
|
@ -17,9 +17,12 @@ export async function Slack() {
|
|||
}
|
||||
).then(r => r.json())
|
||||
|
||||
slackData = slackData.stats.sort((a, b) => a.ds - b.ds).reverse()[0]
|
||||
|
||||
return slackData
|
||||
if (slackData == null || slackData.stats == null) {
|
||||
console.warn("No slack data");
|
||||
return {}
|
||||
} else {
|
||||
return slackData.stats.sort((a, b) => a.ds - b.ds).reverse()[0]
|
||||
}
|
||||
}
|
||||
|
||||
export default async function Slacky(req, res) {
|
||||
|
|
|
|||
|
|
@ -1,6 +1,10 @@
|
|||
import { graphql } from '@octokit/graphql'
|
||||
|
||||
export async function fetchStars() {
|
||||
if (process.env.GITHUB_TOKEN == null) {
|
||||
console.warn("Note - GITHUB_TOKEN not defined, stars will not be fetched from github")
|
||||
return { sprig:"?", sinerider:"?", sprigHardware:"?", hackclub:"?", hackathons:"?"};
|
||||
}
|
||||
const { organization } = await graphql(
|
||||
`
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue