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

Function get

pages/dashboard.ts:12–34  ·  view source on GitHub ↗
({ request, match, user, session, isRunningLocally }: RequestHandlerParams)

Source from the content-addressed store, hash-verified

10const titlePrefix = 'Dashboard';
11
12async function get({ request, match, user, session, isRunningLocally }: RequestHandlerParams) {
13 if (!(await AppConfig.isAppEnabled('dashboard'))) {
14 return new Response('Redirect', { status: 303, headers: { 'Location': `/` } });
15 }
16
17 let userDashboard = await DashboardModel.getByUserId(user!.id);
18
19 if (!userDashboard) {
20 userDashboard = await DashboardModel.create(user!.id);
21 }
22
23 const htmlContent = defaultHtmlContent({ userDashboard });
24
25 return basicLayoutResponse(htmlContent, {
26 currentPath: match.pathname.input,
27 titlePrefix,
28 match,
29 request,
30 user,
31 session,
32 isRunningLocally,
33 });
34}
35
36function defaultHtmlContent({ userDashboard }: { userDashboard: Dashboard }) {
37 const initialNotes = userDashboard?.data?.notes || 'Jot down some notes here.';

Callers

nothing calls this directly

Calls 5

basicLayoutResponseFunction · 0.90
isAppEnabledMethod · 0.80
getByUserIdMethod · 0.80
defaultHtmlContentFunction · 0.70
createMethod · 0.45

Tested by

no test coverage detected