module.exports = /******/ (function(modules) { // webpackBootstrap /******/ // The module cache /******/ var installedModules = require('../../../../../ssr-module-cache.js'); /******/ /******/ // The require function /******/ function __webpack_require__(moduleId) { /******/ /******/ // Check if module is in cache /******/ if(installedModules[moduleId]) { /******/ return installedModules[moduleId].exports; /******/ } /******/ // Create a new module (and put it into the cache) /******/ var module = installedModules[moduleId] = { /******/ i: moduleId, /******/ l: false, /******/ exports: {} /******/ }; /******/ /******/ // Execute the module function /******/ var threw = true; /******/ try { /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); /******/ threw = false; /******/ } finally { /******/ if(threw) delete installedModules[moduleId]; /******/ } /******/ /******/ // Flag the module as loaded /******/ module.l = true; /******/ /******/ // Return the exports of the module /******/ return module.exports; /******/ } /******/ /******/ /******/ // expose the modules object (__webpack_modules__) /******/ __webpack_require__.m = modules; /******/ /******/ // expose the module cache /******/ __webpack_require__.c = installedModules; /******/ /******/ // define getter function for harmony exports /******/ __webpack_require__.d = function(exports, name, getter) { /******/ if(!__webpack_require__.o(exports, name)) { /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter }); /******/ } /******/ }; /******/ /******/ // define __esModule on exports /******/ __webpack_require__.r = function(exports) { /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); /******/ } /******/ Object.defineProperty(exports, '__esModule', { value: true }); /******/ }; /******/ /******/ // create a fake namespace object /******/ // mode & 1: value is a module id, require it /******/ // mode & 2: merge all properties of value into the ns /******/ // mode & 4: return value when already ns object /******/ // mode & 8|1: behave like require /******/ __webpack_require__.t = function(value, mode) { /******/ if(mode & 1) value = __webpack_require__(value); /******/ if(mode & 8) return value; /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value; /******/ var ns = Object.create(null); /******/ __webpack_require__.r(ns); /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value }); /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key)); /******/ return ns; /******/ }; /******/ /******/ // getDefaultExport function for compatibility with non-harmony modules /******/ __webpack_require__.n = function(module) { /******/ var getter = module && module.__esModule ? /******/ function getDefault() { return module['default']; } : /******/ function getModuleExports() { return module; }; /******/ __webpack_require__.d(getter, 'a', getter); /******/ return getter; /******/ }; /******/ /******/ // Object.prototype.hasOwnProperty.call /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; /******/ /******/ // __webpack_public_path__ /******/ __webpack_require__.p = ""; /******/ /******/ /******/ // Load entry module and return exports /******/ return __webpack_require__(__webpack_require__.s = 7); /******/ }) /************************************************************************/ /******/ ({ /***/ "2bMH": /***/ (function(module, exports, __webpack_require__) { "use strict"; var _apollo = _interopRequireDefault(__webpack_require__("B/3u")); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } async function getTransaction(token = "") { var res = await _apollo.default.query(` query { transactions{ id order_id cust_name cust_telp cust_address product_img{ url } product_name product_color product_quantity product_courier product_price } }`, token); return res; } async function getTransactionUnpaid(token = "") { var res = await _apollo.default.query(` query { transactions(where: { status: "1" }){ id order_id cust_name cust_telp cust_address product_img{ url } product_name product_color product_quantity product_courier product_price } }`, token); return res; } async function PayTransactionUnpaid(token = "") { var res = await _apollo.default.query(` query{ transactions(where: { status: "1" }){ id order_id cust_name cust_telp cust_address product_img{ url } product_name product_color product_quantity product_courier product_price } } `, token); return res; } async function getTransactionPrepared(token = "") { var res = await _apollo.default.query(` query { transactions(where: { status: "2" }){ id order_id cust_name cust_telp cust_address product_img{ url } product_name product_color product_quantity product_courier product_price } }`, token); return res; } async function getTransactionSending(token = "") { var res = await _apollo.default.query(` query { transactions(where: { status: "3" }){ id order_id cust_name cust_telp cust_address product_img{ url } product_name product_color product_quantity product_courier product_price } }`, token); return res; } async function getTransactionFinished(token = "") { var res = await _apollo.default.query(` query { transactions(where: { status: "4" }){ id order_id cust_name cust_telp cust_address product_img{ url } product_name product_color product_quantity product_courier product_price } }`, token); return res; } async function newTransactionYamaha(content, token = "") { var res = await _apollo.default.mutation(` mutation($input : TransactionInput!){ createTransaction( input:{data:$input} ) { transaction{ id } } } `, token, { input: content }); return res; } async function newTransactionSuzuki(content, token = "") { var res = await _apollo.default.mutation(` mutation($input : TransactionInput!){ createTransaction( input:{data:$input} ) { transactionSuzuki{ id } } } `, token, { input: content }); return res; } async function newTransactionHonda(content, token = "") { var res = await _apollo.default.mutation(` mutation($input : TransactionInput!){ createTransaction( input:{data:$input} ) { transactionHonda{ id } } } `, token, { input: content }); return res; } async function newTransactionHino(content, token = "") { var res = await _apollo.default.mutation(` mutation($input : TransactionInput!){ createTransaction( input:{data:$input} ) { transactionHino{ id } } } `, token, { input: content }); return res; } module.exports = { newTransactionYamaha: newTransactionYamaha, newTransactionSuzuki: newTransactionSuzuki, newTransactionHonda: newTransactionHonda, newTransactionHino: newTransactionHino, getTransaction: getTransaction, getTransactionUnpaid: getTransactionUnpaid, PayTransactionUnpaid: PayTransactionUnpaid, getTransactionPrepared: getTransactionPrepared, getTransactionSending: getTransactionSending, getTransactionFinished: getTransactionFinished }; /***/ }), /***/ 7: /***/ (function(module, exports, __webpack_require__) { module.exports = __webpack_require__("MHtP"); /***/ }), /***/ "B/3u": /***/ (function(module, exports, __webpack_require__) { "use strict"; var _client = __webpack_require__("z+8S"); var _apolloConfig = _interopRequireDefault(__webpack_require__("bx/+")); var _crossFetch = _interopRequireDefault(__webpack_require__("CCqr")); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function errorHandler(object) { return object.graphQLErrors.length != 0 ? object.graphQLErrors[0].message : object.networkError && object.networkError.result ? object.networkError.result.errors.join(" ; ") : object.networkError ? object.networkError[Object.keys(object.networkError)[0]].toString() : "Fetch failed"; } function initApollo(token) { const httpLink = (0, _client.createHttpLink)({ uri: _apolloConfig.default.graphql_uri, fetch: _crossFetch.default, headers: token != "" ? { Authorization: `Bearer ${token}` } : null }); return new _client.ApolloClient({ ssrMode: false, cache: new _client.InMemoryCache({ addTypename: false }), link: httpLink }); } async function query(query, token = "", variables = {}, cache = false) { const client = initApollo(token); var res; try { var sql = await client.query({ query: (0, _client.gql)` ${query} `, variables: variables, fetchPolicy: cache ? "cache-first" : "no-cache" }); res = { STATUS: 1, DATA: sql.data }; } catch (e) { res = { STATUS: 0, DATA: errorHandler(e) }; } return res; } async function mutation(mutation, token = "", variables = {}) { const client = initApollo(token); var res; try { var sql = await client.mutate({ mutation: (0, _client.gql)` ${mutation} `, variables: variables }); res = { STATUS: 1, DATA: sql.data }; } catch (e) { console.log(e.networkError.result); res = { STATUS: 0, DATA: errorHandler(e) }; } return res; } module.exports = { query: query, mutation: mutation }; /***/ }), /***/ "CCqr": /***/ (function(module, exports) { module.exports = require("cross-fetch"); /***/ }), /***/ "MHtP": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return handler; }); /* harmony import */ var api_transaction_transaction__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("2bMH"); /* harmony import */ var api_transaction_transaction__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(api_transaction_transaction__WEBPACK_IMPORTED_MODULE_0__); async function handler(req, resp) { var input = req.body; var res = await api_transaction_transaction__WEBPACK_IMPORTED_MODULE_0___default.a.newTransactionHino(input); resp.status(200).json(res); } /***/ }), /***/ "bx/+": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); // Apollo Value Configuration const ApolloConfig = { graphql_uri: process.env.API_GRAPHQL_URI }; /* harmony default export */ __webpack_exports__["default"] = (ApolloConfig); /***/ }), /***/ "z+8S": /***/ (function(module, exports) { module.exports = require("@apollo/client"); /***/ }) /******/ });