MCPcopy Index your code
hub / github.com/tiny-pilot/tinypilot / addUser

Function addUser

app/static/js/controllers.js:203–223  ·  view source on GitHub ↗
(username, password, role)

Source from the content-addressed store, hash-verified

201}
202
203export async function addUser(username, password, role) {
204 return fetch("/api/user", {
205 method: "POST",
206 headers: {
207 "X-CSRFToken": getCsrfToken(),
208 "Content-Type": "application/json",
209 },
210 credentials: "same-origin",
211 mode: "same-origin",
212 cache: "no-cache",
213 redirect: "error",
214 body: JSON.stringify({ username, password, role }),
215 })
216 .then(processJsonResponse)
217 .then((data) => {
218 if (!Object.hasOwn(data, "username")) {
219 throw new ControllerError("Missing expected username field");
220 }
221 return { username: data.username };
222 });
223}
224
225export async function updateUserPassword(username, password) {
226 return fetch("/api/user/password", {

Callers

nothing calls this directly

Calls 1

getCsrfTokenFunction · 0.85

Tested by

no test coverage detected