CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In
sagemathinc

Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.

GitHub Repository: sagemathinc/cocalc
Path: blob/master/src/packages/next/pages/api/v2/support/tickets.ts
Views: 687
1
/*
2
Get all support tickets for a signed in user.
3
*/
4
5
import getSupportTickets from "@cocalc/server/support/get-tickets";
6
import getAccountId from "lib/account/get-account";
7
8
export default async function handle(req, res) {
9
const account_id = await getAccountId(req);
10
if (account_id == null) {
11
res.json({ error: "you must be signed in to get support tickets" });
12
return;
13
}
14
15
let tickets;
16
try {
17
tickets = await getSupportTickets(account_id);
18
} catch (err) {
19
res.json({ error: `${err.message}` });
20
return;
21
}
22
res.json({ tickets });
23
}
24
25