Skip to content

Commit

Permalink
fix : 백엔드에서 axios 제거
Browse files Browse the repository at this point in the history
  • Loading branch information
lodado committed Jan 10, 2022
1 parent 6605f10 commit 9501293
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions backend/src/service/UserHasWorkspaceService.ts
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit 9501293

Please sign in to comment.