"use strict";
/*
Get all support tickets for a signed in user.
*/
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const get_tickets_1 = __importDefault(require("@cocalc/server/support/get-tickets"));
const get_account_1 = __importDefault(require("lib/account/get-account"));
async function handle(req, res) {
    const account_id = await (0, get_account_1.default)(req);
    if (account_id == null) {
        res.json({ error: "you must be signed in to get support tickets" });
        return;
    }
    let tickets;
    try {
        tickets = await (0, get_tickets_1.default)(account_id);
    }
    catch (err) {
        res.json({ error: `${err.message}` });
        return;
    }
    res.json({ tickets });
}
exports.default = handle;
//# sourceMappingURL=tickets.js.map