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/lib/share/copy-public-path.ts
Views: 687
1
import api from "lib/api/post";
2
import { join } from "path";
3
4
export default async function copyPublicPath({
5
id,
6
path,
7
url,
8
relativePath,
9
src_project_id,
10
target_project_id,
11
}): Promise<void> {
12
if (url) {
13
await api("/projects/copy-url", {
14
project_id: target_project_id,
15
url,
16
timeout: 60, // if big we do NOT want to allow copying something ridiculuos
17
});
18
}
19
20
await api("/projects/copy-path", {
21
src_project_id,
22
url,
23
target_project_id,
24
path: join(path, relativePath),
25
public_id: id,
26
timeout: 60, // if big we do NOT want to allow copying something ridiculuos
27
});
28
}
29
30