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/licenses/get-license.ts
Views: 687
1
/* Return information about a given license. */
2
3
import getLicense, { License } from "@cocalc/server/licenses/get-license";
4
import getAccountId from "lib/account/get-account";
5
import getParams from "lib/api/get-params";
6
7
export default async function handle(req, res) {
8
try {
9
res.json(await get(req));
10
} catch (err) {
11
res.json({ error: err.message });
12
return;
13
}
14
}
15
16
async function get(req): Promise<License> {
17
const account_id = await getAccountId(req); // account_id = null is OK -- then get very minimal info about the license.
18
const { license_id } = getParams(req);
19
return await getLicense(license_id, account_id);
20
}
21
22