Skip to content

Commit

Permalink
[Fix] team info 잘못 가져오는 오류 수정
Browse files Browse the repository at this point in the history
team_id => team_team_id로 가져오고 있는 것을 확인
select하는 querybuilder에서 execute()를 getOne()으로 바꾸니 해결
  • Loading branch information
LeeMir committed Dec 26, 2021
1 parent c19e626 commit 14feac9
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 8 deletions.
2 changes: 1 addition & 1 deletion backend/src/controllers/team-contorller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ const TeamController = {
try {
const teamRepository = getCustomRepository(TeamRepository);
const team = await teamRepository.read(req.params.teamId);
res.status(200).send(team[0]);
res.status(200).send(team);
} catch (err) {
res.sendStatus(409);
}
Expand Down
8 changes: 3 additions & 5 deletions backend/src/repositories/team-repository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,12 @@ export default class TeamRepository extends AbstractRepository<Team> {
return insertResult.raw.insertId;
}

async read(team_id: number) {
console.log(team_id);
async read(teamId: number) {
const result = await this.repository
.createQueryBuilder('team')
.select()
.where(`team_id = :team_id`, { team_id })
.execute();
console.log(result);
.where(`team_id=:id`, { id: teamId })
.getOne();
return result;
}

Expand Down
4 changes: 2 additions & 2 deletions frontend/src/components/Users/UsersHeader/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ const UsersHeader: React.FC<Props> = ({ teamId }) => {
const teamInfo = useRecoilValue(teamInfoSelector(teamId));
return (
<UserHeaderContainer>
<Thumbnail team_id={teamInfo?.team_id} team_name={teamInfo?.team_name} />
<TeamName>{teamInfo?.team_name}</TeamName>
<Thumbnail team_id={teamInfo.team_id} team_name={teamInfo.team_name} />
<TeamName>{teamInfo.team_name}</TeamName>
</UserHeaderContainer>
);
};
Expand Down

0 comments on commit 14feac9

Please sign in to comment.