Fixed api
This commit is contained in:
@@ -9,7 +9,7 @@ async function unknownResponse(resp) {
|
||||
}
|
||||
}
|
||||
function buildQuery(options) {
|
||||
let query;
|
||||
let query = [];
|
||||
options.forEach(element => {
|
||||
if (element[1] !== undefined) {
|
||||
if (element[1] instanceof Date) {
|
||||
@@ -59,7 +59,7 @@ async function tags(name, limit) {
|
||||
}
|
||||
async function recent(limit = 20) {
|
||||
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();
|
||||
}
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user