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/public-paths/star.ts
Views: 687
1
/*
2
Star a public path
3
4
- id of the public path
5
*/
6
7
import { star } from "@cocalc/server/public-paths/star";
8
import getAccountId from "lib/account/get-account";
9
import getParams from "lib/api/get-params";
10
11
export default async function handle(req, res) {
12
try {
13
const account_id = await getAccountId(req);
14
if (account_id == null) {
15
throw Error("must be signed in to star");
16
}
17
const { id } = getParams(req);
18
if (!id) {
19
throw Error("must specify id of public path");
20
}
21
await star(id, account_id);
22
res.json({});
23
} catch (err) {
24
res.json({ error: `${err.message}` });
25
return;
26
}
27
}
28
29