From c44706f458271c5e7c3ad7ab6b1b0cabe6e075ae Mon Sep 17 00:00:00 2001 From: wajeht <58354193+wajeht@users.noreply.github.com> Date: Fri, 6 Sep 2024 23:47:28 -0500 Subject: [PATCH] style: Remove redundant comments and adjust layout in public.html --- src/app.ts | 1 - src/middleware.ts | 5 ++--- src/types.ts | 4 ++-- src/views/layouts/public.html | 1 + 4 files changed, 5 insertions(+), 6 deletions(-) diff --git a/src/app.ts b/src/app.ts index 3e32c75..477dddc 100644 --- a/src/app.ts +++ b/src/app.ts @@ -6,7 +6,6 @@ import { rateLimitMiddleware, sessionMiddleware, } from './middleware'; - import ejs from 'ejs'; import cors from 'cors'; import path from 'node:path'; diff --git a/src/middleware.ts b/src/middleware.ts index 2206da6..7ad5f2e 100644 --- a/src/middleware.ts +++ b/src/middleware.ts @@ -6,8 +6,8 @@ import { verifyApiKey } from './utils'; import { NotFoundError } from './error'; import rateLimit from 'express-rate-limit'; import connectRedisStore from 'connect-redis'; -import { sessionConfig, appConfig } from './config'; import rateLimitRedisStore from 'rate-limit-redis'; +import { sessionConfig, appConfig } from './config'; import { validationResult } from 'express-validator'; import { NextFunction, Request, Response } from 'express'; @@ -106,8 +106,6 @@ export const validateRequestMiddleware = (schemas: any) => { return acc; }, {}); - console.log(errors); - // Note: is this a good idea? maybe we jus disable a toast since we already all errors state.input? // req.flash('error', Object.values(reshapedErrors)); req.session.errors = reshapedErrors; @@ -200,6 +198,7 @@ export async function appLocalStateMiddleware(req: Request, res: Response, next: res.locals.state['unread_apps_notification_count'] = unread_apps_notification_count; + // adding unread notification counts and channel counts to app id layout const appIdMatch = req.path.match(/^\/apps\/(\d+)/); if (appIdMatch && req.method === 'GET') { // @ts-expect-error diff --git a/src/types.ts b/src/types.ts index 8bde992..d659d79 100644 --- a/src/types.ts +++ b/src/types.ts @@ -1,5 +1,3 @@ -export type Env = 'production' | 'development' | 'testing'; - declare module 'express-session' { interface SessionData { user?: User; @@ -17,6 +15,8 @@ declare global { } } +export type Env = 'production' | 'development' | 'testing'; + export type ApiKeyPayload = { appId: string; userId: string; diff --git a/src/views/layouts/public.html b/src/views/layouts/public.html index aaeb137..b489bc3 100644 --- a/src/views/layouts/public.html +++ b/src/views/layouts/public.html @@ -1,6 +1,7 @@ <%- include('../components/head.html') %> + <%- include('../components/toast.html') %>