Spaces:
Running
Running
Return subscription access on login
Browse files- src/server.ts +2 -1
src/server.ts
CHANGED
|
@@ -300,7 +300,8 @@ app.post("/api/auth/login", authLimiter, async (req, res, next) => {
|
|
| 300 |
if (error || !data.user || !data.session) return res.status(401).json({ error: "Invalid email or password." });
|
| 301 |
await syncProfile(data.user);
|
| 302 |
setSessionCookies(res, data.session);
|
| 303 |
-
|
|
|
|
| 304 |
} catch (error) { next(error); }
|
| 305 |
});
|
| 306 |
|
|
|
|
| 300 |
if (error || !data.user || !data.session) return res.status(401).json({ error: "Invalid email or password." });
|
| 301 |
await syncProfile(data.user);
|
| 302 |
setSessionCookies(res, data.session);
|
| 303 |
+
const subscription = await activeSubscriptionFor(data.user.id);
|
| 304 |
+
return res.json({ user: userPayload(data.user), access: { active: Boolean(subscription), subscription } });
|
| 305 |
} catch (error) { next(error); }
|
| 306 |
});
|
| 307 |
|