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/save.ts
Views: 687
1
/* Request to save a particular public path. */
2
3
import savePublicPath from "@cocalc/server/public-paths/save";
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
const account_id = await getAccountId(req);
10
if (account_id == null) {
11
throw Error(
12
"must be signed in to save public path (have to be collab on project)"
13
);
14
}
15
const { id } = getParams(req);
16
if (!id) {
17
throw Error("must specify id of public path");
18
}
19
await savePublicPath(id, account_id);
20
res.json({});
21
} catch (err) {
22
res.json({ error: `${err.message}` });
23
return;
24
}
25
}
26
27