Fixed api

This commit is contained in:
2022-01-31 12:07:55 +01:00
parent 5171c39861
commit 320c215492
3 changed files with 5 additions and 5 deletions

View File

@@ -11,7 +11,7 @@ async function unknownResponse(resp: Response): Promise<Error> {
}
function buildQuery(options: any[][]): string {
let query: string[]
let query: string[] = []
options.forEach(element => {
if (element[1] !== undefined) {
if (element[1] instanceof Date) {
@@ -89,7 +89,7 @@ async function tags(name?: string, limit?: number): Promise<string[]> {
async function recent(limit: number = 20): Promise<ArticleSummary[]> {
let query = [["limit", limit]]
let result = await fetch(`${prefix}/api/recent?limit=${buildQuery(query)}`)
let result = await fetch(`${prefix}/api/recent?${buildQuery(query)}`)
if (result.status == 200) {
return await result.json()
} else {