From 950129338f06c1fe8ecc4125b66bc2959b2e9c2c Mon Sep 17 00:00:00 2001 From: Lee Date: Tue, 11 Jan 2022 00:14:18 +0900 Subject: [PATCH] =?UTF-8?q?fix=20:=20=EB=B0=B1=EC=97=94=EB=93=9C=EC=97=90?= =?UTF-8?q?=EC=84=9C=20axios=20=EC=A0=9C=EA=B1=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/src/service/UserHasWorkspaceService.ts | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/backend/src/service/UserHasWorkspaceService.ts b/backend/src/service/UserHasWorkspaceService.ts index cb7e170d..ba58005d 100644 --- a/backend/src/service/UserHasWorkspaceService.ts +++ b/backend/src/service/UserHasWorkspaceService.ts @@ -1,8 +1,8 @@ import { StatusCodes } from 'http-status-codes'; import { Request, Response } from 'express'; import { getCustomRepository } from 'typeorm'; -import axios from 'axios'; import UserHasWorkspaceRepository from '../repository/UserHasWorkspaceRepository'; +import UserRepository from '../repository/UserRepository'; import FileRepository from '../repository/FileRepository'; const { BAD_REQUEST, OK } = StatusCodes; @@ -81,10 +81,9 @@ export async function updateUserHasWorkspace(req: Request, res: Response) { userHasWorkspaceById, ); - // eslint-disable-next-line @typescript-eslint/restrict-template-expressions - axios.put(`http://${process.env.HOST}:${process.env.PORT}/api/users/${userId}`, { - theme: userHasWorkspaceById.theme, - }); + const userById = await getCustomRepository(UserRepository).findOneOrFail(Number(userId)); + userById.theme = userHasWorkspaceById.theme ?? userById.theme; + await getCustomRepository(UserRepository).save(userById); return res.status(OK).json({ userHasWorkspace }); } catch (e) {