use api directly

This commit is contained in:
arc-alex
2023-12-19 13:33:57 +01:00
parent fa56f48461
commit 8ae1c6de42
4 changed files with 42 additions and 25 deletions
@@ -464,7 +464,7 @@ export const postNew: RequestHandler = async (req, res) => {
*/
export async function previewSheet(req, res) {
try {
const { id, worksheet } = req.data;
const { id, worksheet } = req.body;
const data = await Sheet.pull(id, worksheet);
res.status(200).send(data);
} catch (error) {
@@ -528,7 +528,6 @@ export async function sheetAuthUrl(req, res) {
* @method POST
*/
export const getSheetState = async (req, res) => {
console.log('getstate', req.body);
const { id, worksheet } = req.body;
res.status(200).send(await Sheet.getSheetState(id, worksheet));
};
@@ -155,8 +155,8 @@ export const validatePatchProjectFile = [
//TODO: is thise correct
export const validateSheetParams = [
body('sheetid').isString().optional({ nullable: false }),
body('worksheet').isString().optional({ nullable: false }),
body('id').exists().isString(),
body('worksheet').exists().isString(),
(req, res, next) => {
const errors = validationResult(req);
if (!errors.isEmpty()) return res.status(422).json({ errors: errors.array() });