mirror of
https://github.com/squidfunk/mkdocs-material.git
synced 2026-07-22 22:03:35 -04:00
Refactored instant loading and some other components
This commit is contained in:
@@ -24,7 +24,7 @@ import { Repo, User } from "github-types"
|
||||
import { Observable } from "rxjs"
|
||||
import { defaultIfEmpty, map } from "rxjs/operators"
|
||||
|
||||
import { fetchJSON } from "~/browser"
|
||||
import { requestJSON } from "~/browser"
|
||||
import { round } from "~/utilities"
|
||||
|
||||
import { SourceFacts } from "../_"
|
||||
@@ -47,7 +47,7 @@ export function fetchSourceFactsFromGitHub(
|
||||
const url = typeof repo !== "undefined"
|
||||
? `https://api.github.com/repos/${user}/${repo}`
|
||||
: `https://api.github.com/users/${user}`
|
||||
return fetchJSON<Repo & User>(url)
|
||||
return requestJSON<Repo & User>(url)
|
||||
.pipe(
|
||||
map(data => {
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ import { ProjectSchema } from "gitlab"
|
||||
import { Observable } from "rxjs"
|
||||
import { defaultIfEmpty, map } from "rxjs/operators"
|
||||
|
||||
import { fetchJSON } from "~/browser"
|
||||
import { requestJSON } from "~/browser"
|
||||
import { round } from "~/utilities"
|
||||
|
||||
import { SourceFacts } from "../_"
|
||||
@@ -45,7 +45,7 @@ export function fetchSourceFactsFromGitLab(
|
||||
base: string, project: string
|
||||
): Observable<SourceFacts> {
|
||||
const url = `https://${base}/api/v4/projects/${encodeURIComponent(project)}`
|
||||
return fetchJSON<ProjectSchema>(url)
|
||||
return requestJSON<ProjectSchema>(url)
|
||||
.pipe(
|
||||
map(({ star_count, forks_count }) => ([
|
||||
`${round(star_count)} Stars`,
|
||||
|
||||
Reference in New Issue
Block a user