MCPcopy Create free account
hub / github.com/bewcloud/bewcloud / post

Function post

pages/api/dashboard/save-links.ts:15–37  ·  view source on GitHub ↗
({ request, user }: RequestHandlerParams)

Source from the content-addressed store, hash-verified

13}
14
15async function post({ request, user }: RequestHandlerParams) {
16 if (!(await AppConfig.isAppEnabled('dashboard'))) {
17 return new Response('Forbidden', { status: 403 });
18 }
19
20 const userDashboard = await DashboardModel.getByUserId(user!.id);
21
22 if (!userDashboard) {
23 return new Response('Not found', { status: 404 });
24 }
25
26 const requestBody = await request.clone().json() as RequestBody;
27
28 if (typeof requestBody.links !== 'undefined') {
29 userDashboard.data.links = requestBody.links;
30
31 await DashboardModel.update(userDashboard);
32 }
33
34 const responseBody: ResponseBody = { success: true };
35
36 return new Response(JSON.stringify(responseBody));
37}
38
39export default page({
40 post,

Callers

nothing calls this directly

Calls 4

isAppEnabledMethod · 0.80
getByUserIdMethod · 0.80
cloneMethod · 0.80
updateMethod · 0.45

Tested by

no test coverage detected