fix: Guard undefined ctx.state

This commit is contained in:
Tom Moor
2023-11-01 23:14:45 -04:00
parent 2838503273
commit 0f072acfd9
2 changed files with 2 additions and 2 deletions

View File

@@ -116,7 +116,7 @@ export async function getTeamFromContext(ctx: Context) {
} else {
team = await Team.findOne();
}
} else if (ctx.state.rootShare) {
} else if (ctx.state?.rootShare) {
team = await Team.findByPk(ctx.state.rootShare.teamId);
} else if (domain.custom) {
team = await Team.findOne({ where: { domain: domain.host } });