Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
sagemathinc
GitHub Repository: sagemathinc/cocalc
Path: blob/master/src/packages/next/pages/api/v2/bookmarks/remove.ts
5823 views
1
/*
2
* This file is part of CoCalc: Copyright © 2024 Sagemath, Inc.
3
* License: MS-RSL – see LICENSE.md for details
4
*/
5
6
// NOOP endpoint - bookmarks now handled by conat
7
// Keeping endpoint for backwards compatibility with older clients
8
9
import { Request } from "express";
10
11
import { STARRED_FILES } from "@cocalc/util/consts/bookmarks";
12
13
async function handle(req, res) {
14
try {
15
res.json(await remove(req));
16
} catch (err) {
17
res.json({ error: `${err.message}` });
18
return;
19
}
20
}
21
22
async function remove(
23
req: Request,
24
): Promise<{
25
status: "success" | "error";
26
project_id?: string;
27
type?: string;
28
error?: string;
29
}> {
30
const { project_id, type } = req.body;
31
32
// NOOP: Always return success since bookmarks are now handled by conat
33
switch (type) {
34
case STARRED_FILES: {
35
return { status: "success", project_id, type };
36
}
37
38
default:
39
return { status: "error", error: `cannot handle type '${type}'` };
40
}
41
}
42
43
export default handle;
44
45