kosei-n hace 2 años
padre
commit
c7642831aa
Se han modificado 1 ficheros con 12 adiciones y 0 borrados
  1. 12 0
      apps/app/src/server/routes/apiv3/page/create-page.ts

+ 12 - 0
apps/app/src/server/routes/apiv3/page/create-page.ts

@@ -8,8 +8,11 @@ import { attachTitleHeader, normalizePath } from '@growi/core/dist/utils/path-ut
 import type { Request, RequestHandler } from 'express';
 import type { ValidationChain } from 'express-validator';
 import { body } from 'express-validator';
+import i18next from 'i18next';
 import mongoose from 'mongoose';
 
+// import { i18n } from '^/config/next-i18next.config';
+
 import { SupportedAction, SupportedTargetModel } from '~/interfaces/activity';
 import type { IApiv3PageCreateParams } from '~/interfaces/apiv3';
 import { subscribeRuleNames } from '~/interfaces/in-app-notification';
@@ -46,6 +49,10 @@ async function determinePath(_parentPath?: string, _path?: string, optionalParen
   // TODO: i18n
   const basePathname = 'Untitled';
 
+  // const test = i18next.t('page_register.form_help.email');
+
+  // console.log(test);
+
   if (_path != null) {
     const path = normalizePath(_path);
 
@@ -90,6 +97,7 @@ type ReqBody = IApiv3PageCreateParams
 
 interface CreatePageRequest extends Request<undefined, ApiV3Response, ReqBody> {
   user: IUserHasId,
+  t,
 }
 
 type CreatePageHandlersFactory = (crowi: Crowi) => RequestHandler[];
@@ -208,6 +216,10 @@ export const createPageHandlersFactory: CreatePageHandlersFactory = (crowi) => {
         body: bodyByParam, pageTags: tagsByParam,
       } = req.body;
 
+      const basePathname = req.t('message.user_id_is_not_available');
+
+      console.log(basePathname);
+
       let pathToCreate: string;
       try {
         const { path, parentPath, optionalParentPath } = req.body;