diff --git a/src/faction/faction.service.ts b/src/faction/faction.service.ts index 287b43438fa0818a60d85c77d4682a55ce4d064d..3681a9404b3f4db704ceb12d50281481c6f01cc5 100644 --- a/src/faction/faction.service.ts +++ b/src/faction/faction.service.ts @@ -156,16 +156,14 @@ export class FactionService { where: { person, game }, relations: ['faction'], }); - if (gameperson.faction) { + if (gameperson && gameperson.faction) { return { factionId: gameperson.faction.factionId, factionName: gameperson.faction.factionName, + role: gameperson.role, }; } else { - throw new HttpException( - gameperson ? 'You are admin for this game!' : 'No faction was found', - HttpStatus.BAD_REQUEST, - ); + return gameperson ? { role: gameperson.role } : { role: '' }; } } }