MCPcopy Create free account
hub / github.com/LumePart/Explo / apiFetch

Function apiFetch

src/web/frontend/src/lib/api.js:12–27  ·  view source on GitHub ↗
(url, options = {})

Source from the content-addressed store, hash-verified

10}
11
12async function apiFetch(url, options = {}) {
13 const method = (options.method || 'GET').toUpperCase()
14
15 const headers = new Headers(options.headers || {})
16
17 if (['POST', 'PUT', 'PATCH', 'DELETE'].includes(method)) {
18 const token = await ensureCSRF()
19 headers.set('X-CSRF-Token', token)
20 }
21
22 return fetch(url, {
23 credentials: 'include',
24 ...options,
25 headers,
26 })
27}
28
29export async function checkAuth() {
30 const res = await fetch('/api/ui/auth/status', { credentials: 'include' })

Callers 15

loginFunction · 0.85
fetchConfigFunction · 0.85
fetchConfigRawFunction · 0.85
saveConfigFunction · 0.85
resetConfigFunction · 0.85
saveScheduleFunction · 0.85
wizardStep1Function · 0.85
wizardStep2Function · 0.85
wizardStep3Function · 0.85
fetchBrowseFunction · 0.85
startRunFunction · 0.85
stopRunFunction · 0.85

Calls 1

ensureCSRFFunction · 0.85

Tested by

no test coverage detected