"use strict";
(() => {
var exports = {};
exports.id = 4340;
exports.ids = [4340];
exports.modules = {

/***/ 9648:
/***/ ((module) => {

module.exports = import("axios");;

/***/ }),

/***/ 8841:
/***/ ((module, __webpack_exports__, __webpack_require__) => {

__webpack_require__.a(module, async (__webpack_handle_async_dependencies__, __webpack_async_result__) => { try {
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "default": () => (/* binding */ handler)
/* harmony export */ });
/* harmony import */ var axios__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(9648);
var __webpack_async_dependencies__ = __webpack_handle_async_dependencies__([axios__WEBPACK_IMPORTED_MODULE_0__]);
axios__WEBPACK_IMPORTED_MODULE_0__ = (__webpack_async_dependencies__.then ? (await __webpack_async_dependencies__)() : __webpack_async_dependencies__)[0];

async function handler(req, res) {
    if (req.method !== "POST") {
        res.status(405).send({
            message: "Only POST requests allowed"
        });
    }
    const { id  } = req.query;
    const token = req.headers.authorization;
    const config = {
        method: "PATCH",
        url: "https://dashboard-apis.iotacademy.ir" + "/roles/" + id,
        ContentType: "application/x-www-form-urlencoded",
        headers: {
            Authorization: token
        },
        data: JSON.parse(req.body)
    };
    const items = await (0,axios__WEBPACK_IMPORTED_MODULE_0__["default"])(config).then(function(response) {
        return response;
    }).catch(function(error) {
        res.status(505).json(error);
    });
    if (items.status === 200) {
        res.status(200).json(items.data);
    } else if (items.response.status === 500) {
        res.status(500).json(items.response.statusText);
    } else if (items.response.status === 404) {
        res.status(404).json(items.response.statusText);
    } else {
        res.status(406).json(items.response.statusText);
    }
}

__webpack_async_result__();
} catch(e) { __webpack_async_result__(e); } });

/***/ })

};
;

// 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_exec__(8841));
module.exports = __webpack_exports__;

})();