dsql-admin/dsql-app/.local_dist/server/pages/api/admin/clientError.js

80 lines
3.0 KiB
JavaScript
Raw Normal View History

2024-11-05 11:12:42 +00:00
"use strict";
(() => {
var exports = {};
exports.id = 7194;
exports.ids = [7194];
exports.modules = {
/***/ 5184:
/***/ ((module) => {
module.exports = require("nodemailer");
/***/ }),
/***/ 7147:
/***/ ((module) => {
module.exports = require("fs");
/***/ }),
/***/ 4177:
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ "default": () => (/* binding */ handler)
/* harmony export */ });
/* harmony import */ var _functions_backend_handleNodemailer__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(6926);
/* harmony import */ var _functions_backend_handleNodemailer__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_functions_backend_handleNodemailer__WEBPACK_IMPORTED_MODULE_0__);
// @ts-check
const fs = __webpack_require__(7147);
/** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /**
* API handler
* ==============================================================================
* @type {import("next").NextApiHandler}
*/ async function handler(req, res) {
/**
* Check method
*
* @description Check request method and return if invalid
*/ if (req.method !== "POST") return res.json({
user: null,
msg: "Failed"
});
/**
* Validate Form
*
* @description Check if request body is valid
*/ const { component , message , user } = req.body;
const log = `💻 CLIENT ERROR ===========================\nUser Id: ${user?.id}\nUser Name: ${user?.first_name} ${user?.last_name}\nUser Email: ${user?.email}\nError Message: ${message}\nComponent: ${component}\nDate: ${Date()}\n========================================`;
const initialText = fs.readFileSync(`./.tmp/error.log`, "utf-8");
fs.writeFileSync(`./.tmp/error.log`, log);
fs.appendFileSync(`./.tmp/error.log`, `\n\n\n\n\n${initialText}`);
////////////////////////////////////////
////////////////////////////////////////
////////////////////////////////////////
res.json({
success: true
});
////////////////////////////////////////
////////////////////////////////////////
////////////////////////////////////////
}
/***/ })
};
;
// load runtime
var __webpack_require__ = require("../../../webpack-api-runtime.js");
__webpack_require__.C(exports);
var __webpack_exec__ = (moduleId) => (__webpack_require__(__webpack_require__.s = moduleId))
var __webpack_exports__ = __webpack_require__.X(0, [6926], () => (__webpack_exec__(4177)));
module.exports = __webpack_exports__;
})();