Skip to content

Commit

Permalink
feat(cta): add new call-to-action controllers for managing call to ac…
Browse files Browse the repository at this point in the history
…tion in dashboard page (#498)
  • Loading branch information
Charlesdoiron authored Apr 2, 2024
1 parent 95ce42d commit e0e18e5
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 0 deletions.
33 changes: 33 additions & 0 deletions api-node/src/controllers/call-to-action.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import express from 'express';
import { withUser } from '~/middlewares/auth';

import { catchErrors } from '~/middlewares/errors';

const callToActionRouter = express.Router();

// Easy way to show a call to action in the dashboard.
// If show is true, the call to action will be displayed.

const callToAction = {
show: true,
title:
'📣\n Un besoin ? Un avis ? Une suggestion ?\n Nous sommes à votre écoute !',
label: 'Ecrivez-nous !',
action: 'FEEDBACK',
};

callToActionRouter.get(
'/',
withUser,
catchErrors(
async (
_req: express.Request,
res: express.Response,
_next: express.NextFunction,
) => {
res.status(200).send({ ok: true, data: callToAction });
},
),
);

export default callToActionRouter;
2 changes: 2 additions & 0 deletions api-node/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import mailRouter from './controllers/mail.ts';
import feedbackRouter from './controllers/feedback.ts';
import notificationRouter from './controllers/notification.ts';
import packageJson from '../package.json';
import callToActionRouter from './controllers/call-to-action.ts';

// Put together a schema
const app = express();
Expand Down Expand Up @@ -110,6 +111,7 @@ app.use('/indicators', indicatorsRouter);
app.use('/mail', mailRouter);
app.use('/feedback', feedbackRouter);
app.use('/notification', notificationRouter);
app.use('/call-to-action', callToActionRouter);
app.use(Sentry.Handlers.errorHandler());
app.use(sendError);

Expand Down

0 comments on commit e0e18e5

Please sign in to comment.