From 3765c177d8ba296e60cbd303b48a3c1b3c816309 Mon Sep 17 00:00:00 2001 From: LeeJongBeom <52884648+devleejb@users.noreply.github.com> Date: Thu, 25 Jan 2024 16:55:49 +0900 Subject: [PATCH] (BE) Error handling for fetch document (#105) * Change fe env for dev mode * Add exception handling for fetch document list --- .../workspace-documents/workspace-documents.service.ts | 8 ++++++-- frontend/.env.development | 4 ++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/backend/src/workspace-documents/workspace-documents.service.ts b/backend/src/workspace-documents/workspace-documents.service.ts index a32296ea..05d4dd52 100644 --- a/backend/src/workspace-documents/workspace-documents.service.ts +++ b/backend/src/workspace-documents/workspace-documents.service.ts @@ -79,7 +79,9 @@ export class WorkspaceDocumentsService { return this.findDocumentFromYorkie(doc.yorkieDocumentId).then((yorkieDoc) => { return { ...doc, - updatedAt: moment(yorkieDoc.document.updatedAt).toDate(), + updatedAt: yorkieDoc.document?.updatedAt + ? moment(yorkieDoc.document?.updatedAt).toDate() + : doc.updatedAt, }; }); }) @@ -153,7 +155,9 @@ export class WorkspaceDocumentsService { }; } - async findDocumentFromYorkie(documentKey: string): Promise { + async findDocumentFromYorkie( + documentKey: string + ): Promise { return new Promise((resolve, reject) => { const client = connect(`${this.configService.get("YORKIE_API_ADDR")}`); diff --git a/frontend/.env.development b/frontend/.env.development index be08dbc1..855fc6af 100644 --- a/frontend/.env.development +++ b/frontend/.env.development @@ -1,3 +1,3 @@ VITE_API_ADDR="http://localhost:3000" -VITE_YORKIE_API_ADDR="https://api.yorkie.dev" -VITE_YORKIE_API_KEY="cmftp10ksk14av0kc7gg" +VITE_YORKIE_API_ADDR="http://localhost:8080" +VITE_YORKIE_API_KEY=""