MCPcopy
hub / github.com/Peppermint-Lab/peppermint / addTime

Function addTime

apps/client/components/TicketDetails/index.tsx:336–364  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

334 }
335
336 async function addTime() {
337 if (data && data.ticket && data.ticket.locked) return;
338
339 await fetch(`/api/v1/time/new`, {
340 method: "POST",
341 headers: {
342 "Content-Type": "application/json",
343 Authorization: `Bearer ${token}`,
344 },
345 body: JSON.stringify({
346 time: timeSpent,
347 ticket: id,
348 title: timeReason,
349 user: user.id,
350 }),
351 })
352 .then((res) => res.json())
353 .then((res) => {
354 if (res.success) {
355 setTimeEdit(false);
356 refetch();
357 toast({
358 variant: "default",
359 title: "Time Added",
360 description: "Time has been added to the ticket",
361 });
362 }
363 });
364 }
365
366 async function fetchUsers() {
367 const res = await fetch(`/api/v1/users/all`, {

Callers

nothing calls this directly

Calls 1

toastFunction · 0.90

Tested by

no test coverage detected