MCPcopy Create free account
hub / github.com/error311/FileRise / apiPost

Function apiPost

public/js/adminPanel.js:3426–3445  ·  view source on GitHub ↗
(url, payload = {})

Source from the content-addressed store, hash-verified

3424 };
3425
3426 const apiPost = async (url, payload = {}) => {
3427 const res = await fetch(withBase(url), {
3428 method: 'POST',
3429 credentials: 'include',
3430 headers: {
3431 'Content-Type': 'application/json',
3432 'X-CSRF-Token': getCsrf(),
3433 'Accept': 'application/json',
3434 },
3435 body: JSON.stringify(payload || {}),
3436 });
3437 const data = await safeJson(res);
3438 if (!res.ok || !data) {
3439 throw new Error(data?.error || tf('error', 'Error'));
3440 }
3441 if (data.ok !== true) {
3442 throw new Error(data?.error || tf('error', 'Error'));
3443 }
3444 return data;
3445 };
3446
3447 const setGatewayTab = (tab) => {
3448 const t = String(tab || 'shares').toLowerCase() === 'mcp' ? 'mcp' : 'shares';

Callers 7

runManagedActionFunction · 0.70
runMcpServiceActionFunction · 0.70
saveMcpUserFunction · 0.70
deleteMcpUserFunction · 0.70
queueGatewayCleanupJobFunction · 0.70
queueMcpAutotagJobFunction · 0.70
initGatewaysSectionFunction · 0.70

Calls 4

withBaseFunction · 0.85
getCsrfFunction · 0.85
safeJsonFunction · 0.70
tfFunction · 0.70

Tested by

no test coverage detected