perf: Remove unneeded query before custom domain redirect

This commit is contained in:
Tom Moor
2023-10-31 22:32:29 -04:00
parent 0700e2f5ef
commit 1d6ef2e1b3

View File

@@ -130,6 +130,13 @@ router.get("/s/:shareId/*", renderShare);
// catch all for application
router.get("*", async (ctx, next) => {
const team = await getTeamFromContext(ctx);
// Redirect all requests to custom domain if one is set
if (team?.domain && team.domain !== ctx.hostname) {
ctx.redirect(ctx.href.replace(ctx.hostname, team.domain));
return;
}
const analytics = team
? await Integration.findOne({
where: {
@@ -139,12 +146,6 @@ router.get("*", async (ctx, next) => {
})
: undefined;
// Redirect all requests to custom domain if one is set
if (team?.domain && team.domain !== ctx.hostname) {
ctx.redirect(ctx.href.replace(ctx.hostname, team.domain));
return;
}
return renderApp(ctx, next, {
analytics,
});