Skip to content

Commit

Permalink
fix: Do not query User in non-user mode
Browse files Browse the repository at this point in the history
  • Loading branch information
pettermachado committed Nov 8, 2024
1 parent 684bd65 commit 5fcb9e9
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions api/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -356,8 +356,13 @@ const cache = process.env["DB_CACHE"]
const soundtrackApi = new Api({ cache, tokenSource });

router.get("/auth/mode", async (req, res) => {
const user = await User.findByPk(0);
res.json({ mode: soundtrackApi.mode, loggedIn: !!user });
const mode = soundtrackApi.mode;
if (mode === "user") {
const user = await User.findByPk(0);
res.json({ mode, loggedIn: !!user });
} else {
res.json({ mode, loggedIn: false });
}
});

router.post("/auth/login", async (req, res) => {
Expand Down

0 comments on commit 5fcb9e9

Please sign in to comment.