Skip to content
Source
Sign inSign up
TanStack/query
Open History to see the last commit

data.ts

18 lines389 Bytes

1// an simple endpoint for getting current list
2let list = ['Item 1', 'Item 2', 'Item 3']
3​
4export default defineEventHandler(async (event) => {
5 const { add, clear } = getQuery(event)
6​
7 if (typeof add === 'string' && add) {
8 if (!list.includes(add)) {
9 list.push(add)
10 }
11 } else if (clear) {
12 list = []
13 }
14​
15 await new Promise((r) => setTimeout(r, 100))
16​
17 return list
18})