Make limit "configurable" in welcome script
This commit is contained in:
parent
3878802c03
commit
501bf1609b
@ -25,6 +25,8 @@ if (!SN_API_KEY) {
|
|||||||
process.exit(1)
|
process.exit(1)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const LIMIT = 21
|
||||||
|
|
||||||
async function gql (query, variables = {}) {
|
async function gql (query, variables = {}) {
|
||||||
const response = await fetch(`${SN_API_URL}/api/graphql`, {
|
const response = await fetch(`${SN_API_URL}/api/graphql`, {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
@ -73,8 +75,8 @@ function fetchRecentBios () {
|
|||||||
// fetch all recent bios. we assume here there won't be more than 21
|
// fetch all recent bios. we assume here there won't be more than 21
|
||||||
// since the last bio we already included in a post as defined by FETCH_AFTER.
|
// since the last bio we already included in a post as defined by FETCH_AFTER.
|
||||||
return gql(
|
return gql(
|
||||||
`query NewBios {
|
`query NewBios($limit: Limit!) {
|
||||||
items(sort: "recent", type: "bios", limit: 21) {
|
items(sort: "recent", type: "bios", limit: $limit) {
|
||||||
items {
|
items {
|
||||||
id
|
id
|
||||||
title
|
title
|
||||||
@ -89,7 +91,7 @@ function fetchRecentBios () {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}`
|
}`, { limit: LIMIT }
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user