snapshot of https://github.com/TanStack/query.git (main, 2026-09-16; blobs > 131072B omitted)
Some checks failed
autofix.ci / autofix (push) Failing after 4s
Release / Release (push) Has been skipped
GitHub Actions Security Analysis / Run zizmor (push) Failing after 2s

This commit is contained in:
upstream-mirror
2026-09-16 01:13:08 +05:00
commit 3a013ccdfe
3570 changed files with 490194 additions and 0 deletions

View File

@@ -0,0 +1,40 @@
import { HttpResponse } from '@angular/common/http'
import { delay, of } from 'rxjs'
import type { Observable } from 'rxjs'
import type { HttpEvent, HttpInterceptorFn } from '@angular/common/http'
export const projectsMockInterceptor: HttpInterceptorFn = (
req,
next,
): Observable<HttpEvent<any>> => {
const { url } = req
if (url.includes('/api/projects')) {
const page = parseInt(
new URLSearchParams(req.url.split('?')[1]).get('page') || '0',
10,
)
const pageSize = 10
const projects = Array(pageSize)
.fill(0)
.map((_, i) => {
const id = page * pageSize + (i + 1)
return {
name: 'Project ' + id,
id,
}
})
return of(
new HttpResponse({
status: 200,
body: {
projects,
hasMore: page < 9,
},
}),
).pipe(delay(1000))
}
return next(req)
}