"use strict";
/*
Create a support ticket.
*/
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const create_ticket_1 = __importDefault(require("@cocalc/server/support/create-ticket"));
const get_account_1 = __importDefault(require("lib/account/get-account"));
const get_params_1 = __importDefault(require("lib/api/get-params"));
async function handle(req, res) {
    const { options } = (0, get_params_1.default)(req);
    let url;
    try {
        const account_id = await (0, get_account_1.default)(req);
        url = await (0, create_ticket_1.default)({ ...options, account_id });
    }
    catch (err) {
        res.json({ error: `${err.message}` });
        return;
    }
    res.json({ url });
}
exports.default = handle;
//# sourceMappingURL=create-ticket.js.map