mirror of
https://github.com/freeCodeCamp/freeCodeCamp.git
synced 2026-03-25 23:02:05 -04:00
* refactor: explicit types for validate * refactor: explicit return types for ui-components * refactor: use exec instead of match * refactor: add lots more boundary types * refactor: more eslint warnings * refactor: more explicit exports * refactor: more explicit types * refactor: even more explicit types * fix: relax type contrainsts for superblock-order * refactor: final boundaries * refactor: avoid using 'object' type * fix: use named import for captureException This uses TypeScript (which works) instead of import/namespace (which doesn't) to check if captureException exists in sentry/gatsby (it does)
16 lines
544 B
TypeScript
16 lines
544 B
TypeScript
import { Request, Response } from 'express';
|
|
import { saveStep } from '../utils/save-step';
|
|
|
|
export const saveRoute = async (req: Request, res: Response): Promise<void> => {
|
|
const { superblock, block, step } = req.params;
|
|
const content = (req.body as { content: string }).content;
|
|
|
|
const success = await saveStep(superblock, block, step, content);
|
|
|
|
const message = success
|
|
? 'Your changes have been saved and are ready to commit!'
|
|
: 'There was an error when saving your changes. Please try again.';
|
|
|
|
res.json({ message });
|
|
};
|