line_push/.nuxt/dist/server/pages/submit.js
2022-07-21 03:28:35 +00:00

60 lines
1.3 KiB
JavaScript

exports.ids = [3];
exports.modules = {
/***/ 87:
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
const ENDPOINT = "https://api.contree.io/profile";
const ENDPOINT2 = "https://nodered.contree.io/contree_push";
/* harmony default export */ __webpack_exports__["default"] = ({
template: '<p>OK</p>',
async middleware({
req,
error,
$axios,
redirect
}) {
const data = await new Promise(resolve => {
let body = '';
req.on('data', data => {
body += data;
});
req.on('end', () => {
resolve(JSON.parse(body));
});
});
const uid = data.LINEUserID = data.LINEUserID || 'test';
let response = await $axios.get(ENDPOINT, {
params: {
LINEUserID: uid
}
});
const vnum = data.VerifyNUM;
const vsys = data.VerifySys; //data.BeaconMode = 'leave'
//data.FLAG = false
if (response.data.length > 0) {
const id = response.data[0].id;
await $axios.patch(`${ENDPOINT}/${id}`, data);
} else {
await $axios.post(ENDPOINT, data);
}
await $axios.get(ENDPOINT2, {
params: {
userid: uid,
Verify: vnum,
VerifySys: vsys
}
});
}
});
/***/ })
};;
//# sourceMappingURL=submit.js.map