payload
Version:
Node, React, Headless CMS and Application Framework built on Next.js
16 lines (15 loc) • 536 B
JavaScript
// @ts-strict-ignore
/**
* Rollback the transaction from the req using the db adapter and removes it from the req
*/ export async function killTransaction(req) {
const { payload, transactionID } = req;
if (transactionID && !(transactionID instanceof Promise)) {
try {
await payload.db.rollbackTransaction(req.transactionID);
} catch (error) {
// swallow any errors while attempting to rollback
}
delete req.transactionID;
}
}
//# sourceMappingURL=killTransaction.js.map