fix: Fixes cursor handling for API link requests

Replaces the cursor value in the API request with `undefined` if it is falsy. This prevents potential issues with null values being sent in the query, ensuring a more reliable API interaction.

Improves overall stability when fetching link data from the server.
This commit is contained in:
ccbikai 2024-12-06 13:49:58 +08:00
parent 09cae1b588
commit 83db9cd2bc

View file

@ -11,7 +11,7 @@ async function getLinks() {
const data = await useAPI('/api/link/list', {
query: {
limit,
cursor,
cursor: cursor || undefined,
},
})
links.value = links.value.concat(data.links).filter(Boolean) // Sometimes cloudflare will return null, filter out