mirror of
https://github.com/squidfunk/mkdocs-material.git
synced 2026-08-04 19:45:08 -04:00
Fixed source integrations after refactoring
This commit is contained in:
@@ -22,7 +22,7 @@
|
||||
|
||||
import { Repo, User } from "github-types"
|
||||
import { Observable, from } from "rxjs"
|
||||
import { filter, map } from "rxjs/operators"
|
||||
import { map } from "rxjs/operators"
|
||||
|
||||
import { round } from "utilities"
|
||||
|
||||
@@ -48,12 +48,11 @@ export function fetchSourceFactsFromGitHub(
|
||||
: `https://api.github.com/users/${user}`
|
||||
return from(fetch(url).then(res => res.json()))
|
||||
.pipe(
|
||||
filter(({ status }) => status === 200),
|
||||
map(({ response }) => {
|
||||
map(data => {
|
||||
|
||||
/* GitHub repository */
|
||||
if (typeof repo !== "undefined") {
|
||||
const { stargazers_count, forks_count }: Repo = response
|
||||
const { stargazers_count, forks_count }: Repo = data
|
||||
return [
|
||||
`${round(stargazers_count || 0)} Stars`,
|
||||
`${round(forks_count || 0)} Forks`
|
||||
@@ -61,7 +60,7 @@ export function fetchSourceFactsFromGitHub(
|
||||
|
||||
/* GitHub user/organization */
|
||||
} else {
|
||||
const { public_repos }: User = response
|
||||
const { public_repos }: User = data
|
||||
return [
|
||||
`${round(public_repos || 0)} Repositories`
|
||||
]
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
|
||||
import { ProjectSchema } from "gitlab"
|
||||
import { Observable, from } from "rxjs"
|
||||
import { filter, map } from "rxjs/operators"
|
||||
import { map } from "rxjs/operators"
|
||||
|
||||
import { round } from "utilities"
|
||||
|
||||
@@ -46,8 +46,6 @@ export function fetchSourceFactsFromGitLab(
|
||||
const url = `https://${base}/api/v4/projects/${encodeURIComponent(project)}`
|
||||
return from(fetch(url).then(res => res.json()))
|
||||
.pipe(
|
||||
filter(({ status }) => status === 200),
|
||||
map(({ response }) => response),
|
||||
map(({ star_count, forks_count }: ProjectSchema) => ([
|
||||
`${round(star_count)} Stars`,
|
||||
`${round(forks_count)} Forks`
|
||||
|
||||
Reference in New Issue
Block a user