Some checks failed
Build & Deploy / 🔍 Prepare (push) Successful in 20s
Build & Deploy / 🧪 QA (push) Failing after 34s
Build & Deploy / 🏗️ Build (push) Has started running
Build & Deploy / 🚀 Deploy (push) Has been cancelled
Build & Deploy / 🧪 Smoke Test (push) Has been cancelled
Build & Deploy / ⚡ Lighthouse (push) Has been cancelled
Build & Deploy / 🔔 Notify (push) Has been cancelled
1 line
2.0 KiB
Plaintext
1 line
2.0 KiB
Plaintext
{"version":3,"sources":["../../../src/preferences/requestHandlers/delete.ts"],"sourcesContent":["import { status as httpStatus } from 'http-status'\n\nimport type { PayloadHandler } from '../../config/types.js'\nimport type { PayloadRequest } from '../../types/index.js'\n\nimport { deleteOperation } from '../operations/delete.js'\n\nexport const deleteHandler: PayloadHandler = async (incomingReq): Promise<Response> => {\n // We cannot import the addDataAndFileToRequest utility here from the 'next' package because of dependency issues\n // However that utility should be used where possible instead of manually appending the data\n let data\n\n try {\n data = await incomingReq.json?.()\n } catch (ignore) {\n data = {}\n }\n\n const reqWithData: PayloadRequest = incomingReq\n\n if (data) {\n reqWithData.data = data\n // @ts-expect-error\n reqWithData.json = () => Promise.resolve(data)\n }\n\n const result = await deleteOperation({\n key: reqWithData.routeParams?.key as string,\n req: reqWithData,\n user: reqWithData.user,\n })\n\n return Response.json(\n {\n ...result,\n message: reqWithData.t('general:deletedSuccessfully'),\n },\n {\n status: httpStatus.OK,\n },\n )\n}\n"],"names":["status","httpStatus","deleteOperation","deleteHandler","incomingReq","data","json","ignore","reqWithData","Promise","resolve","result","key","routeParams","req","user","Response","message","t","OK"],"mappings":"AAAA,SAASA,UAAUC,UAAU,QAAQ,cAAa;AAKlD,SAASC,eAAe,QAAQ,0BAAyB;AAEzD,OAAO,MAAMC,gBAAgC,OAAOC;IAClD,iHAAiH;IACjH,4FAA4F;IAC5F,IAAIC;IAEJ,IAAI;QACFA,OAAO,MAAMD,YAAYE,IAAI;IAC/B,EAAE,OAAOC,QAAQ;QACfF,OAAO,CAAC;IACV;IAEA,MAAMG,cAA8BJ;IAEpC,IAAIC,MAAM;QACRG,YAAYH,IAAI,GAAGA;QACnB,mBAAmB;QACnBG,YAAYF,IAAI,GAAG,IAAMG,QAAQC,OAAO,CAACL;IAC3C;IAEA,MAAMM,SAAS,MAAMT,gBAAgB;QACnCU,KAAKJ,YAAYK,WAAW,EAAED;QAC9BE,KAAKN;QACLO,MAAMP,YAAYO,IAAI;IACxB;IAEA,OAAOC,SAASV,IAAI,CAClB;QACE,GAAGK,MAAM;QACTM,SAAST,YAAYU,CAAC,CAAC;IACzB,GACA;QACElB,QAAQC,WAAWkB,EAAE;IACvB;AAEJ,EAAC"} |